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

19003번 - Rikka with Equation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB84375.000%

문제

The conclusion of Hilbert's tenth problem shows that it is impossible to design an algorithm to find all integer solutions of an arbitrary system of equations. But for some simple equations, is is still easily doable.

For example, how do we check if there exist two integers $x$ and $y$ which satisfy $x^2 + y^2 = a$ and $x y = b$? We can calculate $x + y = \pm \sqrt{a + 2b}$ and $x - y = \pm \sqrt{a - 2b},ドル and then check if both $x$ and $y$ could be integers.

Rikka thinks this task is too simple, and she wants to make it look harder. Rikka knows that sometimes, if you consider an equality modulo $m,ドル the problem becomes different. So, she wants to do the same thing to this problem.

Let us call a tuple $(a, b, m)$ (0ドル \leq a, b < m$) valid if and only if there exist two integers $x$ and $y$ which satisfy $x^2 + y^2 \equiv a \pmod{m}$ and $x y \equiv b \pmod{m}$. After giving you a positive integer $n,ドル Rikka wants you to calculate the number of valid tuples $(a, b, m)$ with $m \leq n$. As this number may be rather large, calculate it modulo 998ドル,244円,353円$.

입력

The first line contains a single integer $t$ (1ドル \leq t \leq 10^5$), the number of test cases.

Each test case is given on a separate line containing a single integer $n$ (1ドル \leq n \leq 10^7$).

출력

For each test case, output a single line with a single integer: the number of valid tuples modulo 998ドル,244円,353円$.

제한

예제 입력 1

5
3
5
10
100
1000

예제 출력 1

8
22
104
45933
32791150

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 6: Ruyi Ji Contest 4 E번

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

출처

대학교 대회

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

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