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

25108번 - Lines in a grid 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 1024 MB61302350.000%

문제

Suppose that we are given a $n × n$ integer grid, e.g. $\{(i, j)\}_{i=0, j=0}^{n-1, n-1}$. Let $l_n$ be the number of different lines that intersect with at least two points on the grid.

For $n = 3,ドル there are exactly 20ドル$ such lines, as drawn on the image below.

Compute $l_n$ for all given $n$.

입력

First line contains an integer $Q$ – the number of queries. The second line contains $Q$ space-separated integers $n_1, \dots , n_Q$.

출력

Print $Q$ numbers $l_{n_1} , \dots , l_{n_N},ドル each in its own line. Since $l_k$ can be large, print them modulo 10ドル^6 + 3$.

제한

  • 1ドル ≤ Q ≤ 1000$
  • 1ドル ≤ n_i ≤ 10^7$

예제 입력 1

3
1 3 2

예제 출력 1

0
20
6

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2021 G번

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

출처

대학교 대회

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

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