Logo
(追記) (追記ここまで)

6077번 - Patting Heads 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB83484470.968%

문제

It's Bessie's birthday and time for party games! Bessie has instructed the N (1 <= N <= 100,000) cows conveniently numbered 1..N to sit in a circle (so that cow i [except at the ends] sits next to cows i-1 and i+1; cow N sits next to cow 1). Meanwhile, Farmer John fills a barrel with one billion slips of paper, each containing some integer in the range 1..1,000,000.

Each cow i then draws a number A_i (1 <= A_i <= 1,000,000) (which is not necessarily unique, of course) from the giant barrel. Taking turns, each cow i then takes a walk around the circle and pats the heads of all other cows j such that her number A_i is exactly divisible by cow j's number A_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: N
  • Lines 2..N+1: Line i+1 contains a single integer: A_i

출력

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

제한

예제 입력 1

5
2
1
2
3
4

예제 출력 1

2
0
2
1
3

힌트

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

출처

Olympiad > USA Computing Olympiad > 2008-2009 Season > USACO December 2008 Contest > Silver 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /