結果

問題 No.1514 Squared Matching
ユーザー convexineq
提出日時 2021-05-21 21:41:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,811 ms / 4,000 ms
コード長 369 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 82,112 KB
実行使用メモリ 467,328 KB
最終ジャッジ日時 2024-10-10 08:14:57
合計ジャッジ時間 63,640 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def isqrt(n):
    assert n >= 0
    if n < 2: return n
    x = int(n**0.5)*2
    while x*x > n:
        x = (x+n//x)//2
    return x

n = int(input())
ans = 0
r = [1]*(n+1)
for i in range(1,n+1):
    if r[i] == 0: continue
    c = 0
    for j in range(1,n+1):
        v = i*j*j
        if v > n: break
        c += 1
        r[v] = 0
    ans += isqrt(n//i)*c
print(ans)
0