31 lines
850 B
Java
31 lines
850 B
Java
import java.util.*;
|
|
|
|
public class _27172 {
|
|
static int MAX_N = 1000001;
|
|
public static void main(String[] args) {
|
|
Scanner sc = new Scanner(System.in);
|
|
int N = Integer.parseInt(sc.nextLine());
|
|
int[] nums = Arrays.stream(sc.nextLine().split(" "))
|
|
.mapToInt(Integer::parseInt)
|
|
.toArray();
|
|
sc.close();
|
|
|
|
int[] scores = new int[MAX_N];
|
|
boolean[] cards = new boolean[MAX_N];
|
|
for (int n : nums) {
|
|
cards[n] = true;
|
|
}
|
|
|
|
for(int i=0; i<N; i++) {
|
|
for(int n=nums[i]*2; n<MAX_N; n+=nums[i]) {
|
|
if(cards[n]) {
|
|
scores[nums[i]]++;
|
|
scores[n]--;
|
|
}
|
|
}
|
|
}
|
|
|
|
for(int n: nums) System.out.printf("%d ", scores[n]);
|
|
}
|
|
}
|