結果

問題 No.1022 Power Equation
ユーザー convexineqconvexineq
提出日時 2021-05-06 23:14:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 1,826 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 76,796 KB
最終ジャッジ日時 2023-10-12 15:37:23
合計ジャッジ時間 3,524 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,780 KB
testcase_01 AC 86 ms
76,396 KB
testcase_02 AC 85 ms
76,796 KB
testcase_03 AC 86 ms
76,788 KB
testcase_04 AC 96 ms
76,644 KB
testcase_05 AC 103 ms
76,604 KB
testcase_06 AC 100 ms
76,604 KB
testcase_07 AC 100 ms
76,264 KB
testcase_08 AC 92 ms
76,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
def root(n,k):
    for i in range(n+9):
        if i**k > n: return i-2

t,*a = map(int,open(0).read().split())
for n in a:
    R = [0,0]+[root(n,k) for k in range(2,30)]
    ans = 2*n*n-n
    for i in range(1,30):
        for j in range(i+1,30):
            if gcd(i,j) > 1: continue
            ans += n//j*R[j]*2
    print(ans)
0