結果

問題 No.2552 Not Coprime, Not Divisor
ユーザー rlangevinrlangevin
提出日時 2023-12-26 08:57:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 91,088 KB
最終ジャッジ日時 2023-12-26 08:57:18
合計ジャッジ時間 4,764 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
82,356 KB
testcase_01 AC 222 ms
87,744 KB
testcase_02 AC 115 ms
81,416 KB
testcase_03 AC 221 ms
87,644 KB
testcase_04 AC 226 ms
87,564 KB
testcase_05 AC 73 ms
70,920 KB
testcase_06 AC 248 ms
88,612 KB
testcase_07 AC 281 ms
90,204 KB
testcase_08 AC 181 ms
85,660 KB
testcase_09 AC 310 ms
91,088 KB
testcase_10 AC 111 ms
80,848 KB
testcase_11 AC 158 ms
84,480 KB
testcase_12 AC 272 ms
90,564 KB
testcase_13 AC 122 ms
81,804 KB
testcase_14 AC 96 ms
77,820 KB
testcase_15 AC 38 ms
53,460 KB
testcase_16 AC 38 ms
53,460 KB
testcase_17 AC 89 ms
76,280 KB
testcase_18 AC 38 ms
53,460 KB
testcase_19 AC 38 ms
53,460 KB
testcase_20 AC 39 ms
53,460 KB
testcase_21 AC 40 ms
53,460 KB
testcase_22 AC 39 ms
53,460 KB
testcase_23 AC 38 ms
53,460 KB
testcase_24 AC 38 ms
53,460 KB
testcase_25 AC 39 ms
53,460 KB
testcase_26 AC 39 ms
53,460 KB
testcase_27 AC 40 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def euler_phi2(N):
    phi = list(range(N + 1))
    for x in range(2, N + 1):
        if phi[x] == x:
            for y in range(x, N + 1, x):
                phi[y] = phi[y] // x * (x - 1)
    return phi


N = int(input())
div = [0] * (N + 1)
ans = N * (N + 1) //2
for i in range(2, N + 1):
    for j in range(i, N + 1, i):
        div[j] += 1

print(ans - sum(div) - sum(euler_phi2(N)))
0