結果
問題 | No.2249 GCDistance |
ユーザー | sotanishy |
提出日時 | 2023-03-17 22:04:46 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,700 ms / 5,000 ms |
コード長 | 388 bytes |
コンパイル時間 | 277 ms |
コンパイル使用メモリ | 81,464 KB |
実行使用メモリ | 339,228 KB |
最終ジャッジ日時 | 2023-10-18 14:52:49 |
合計ジャッジ時間 | 21,831 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,568 ms
339,228 KB |
testcase_01 | AC | 1,679 ms
339,228 KB |
testcase_02 | AC | 1,678 ms
339,228 KB |
testcase_03 | AC | 1,692 ms
339,228 KB |
testcase_04 | AC | 1,633 ms
339,228 KB |
testcase_05 | AC | 1,672 ms
339,228 KB |
testcase_06 | AC | 1,698 ms
339,228 KB |
testcase_07 | AC | 1,693 ms
339,228 KB |
testcase_08 | AC | 1,598 ms
339,228 KB |
testcase_09 | AC | 1,700 ms
339,228 KB |
testcase_10 | AC | 1,669 ms
339,228 KB |
ソースコード
from itertools import accumulate import sys input = sys.stdin.readline M = 10**7 totient = list(range(M+1)) for i in range(2, M+1): if totient[i] == i: for j in range(i, M+1, i): totient[j] = totient[j] // i * (i-1) totient = list(accumulate(totient)) T = int(input()) for _ in range(T): N = int(input()) ans = N * (N - 1) - totient[N] + 1 print(ans)