#Q201. 「一本通 6.2 练习 2」轻拍牛头
「一本通 6.2 练习 2」轻拍牛头
Description
Original source: USACO 2008 Dec. Silver
Today is Bessie's birthday, and it's time for party games. Bessie has arranged for cows numbered to sit in a circle (so except for the last cow, the -th cow is adjacent to the -th and -th cows, and the -th cow is adjacent to the -th and the -st cow). Meanwhile, Farmer John brings a bucket containing a billion small slips of paper, each with an integer between written on it.
Next, each cow takes turns drawing a number from the massive bucket (these numbers do not need to be distinct). Then, the -th cow walks around the circle, and if the number in cow 's hand is divisible by the number in cow 's hand , cow will pat cow on the head. After completing the circle, cow returns to its original position.
The cows want you to help them calculate, for each cow, how many cows it needs to pat on the head?
Input Format
The first line contains an integer ;
The next lines each contain an integer .
Output Format
Output lines, where the -th line indicates the number of cows the -th cow needs to pat.
Sample 1
The first cow will pat the second and third cows, the second cow will pat no cows, and so on.
5
2
1
2
3
4
2
0
2
1
3
Data Range and Hints
For all data, .