LG#P2926. 【GESP强化 五级】Patting Heads S

提交0 通过0
通过率0%
时间限制1000ms
内存限制128MiB
    ID: 10317 传统题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 普及 上传者: 标签>GESPGESP强化C++c++编程题洛谷公开题数学2008USACO素数判断数论

题目描述

题目描述

It's Bessie's birthday and time for party games! Bessie has instructed the NN (1N1051 \le N \le 10^5) cows conveniently numbered 1N1\cdots N to sit in a circle (so that cow ii [except at the ends] sits next to cows i1i-1 and i+1i+1; cow NN sits next to cow 11). Meanwhile, Farmer John fills a barrel with one billion slips of paper, each containing some integer in the range 11061 \sim 10^6.

Each cow i then draws a number AiA_i (1Ai1061 \le A_i \le 10^6) (which is not necessarily unique, of course) from the giant barrel. Taking turns, each cow ii then takes a walk around the circle and pats the heads of all other cows jj such that her number AiA_i is exactly divisible by cow jj's number AjA_j; she then sits again back in her original position.

The cows would like you to help them determine, for each cow, the number of other cows she should pat.

输入格式

  • Line 1: A single integer: NN

  • Lines 2N+12\sim N+1: Line i+1i+1 contains a single integer: AiA_i

输出格式

  • Lines 1N1\sim N: On line ii, print a single integer that is the number of other cows patted by cow ii.

输入输出样例

5 
2 
1 
2 
3 
4
2 
0 
2 
1 
3

说明/提示

The 55 cows are given the numbers 22, 11, 22, 33, and 44, respectively.

The first cow pats the second and third cows; the second cow pats no cows; etc.

1
175566
0
2
513646
800365
0
0