結果
問題 |
No.1514 Squared Matching
|
ユーザー |
![]() |
提出日時 | 2021-05-21 22:10:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 3,434 ms / 4,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 82,208 KB |
実行使用メモリ | 468,224 KB |
最終ジャッジ日時 | 2024-10-10 08:55:28 |
合計ジャッジ時間 | 50,263 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 26 |
ソースコード
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()) r = [1]*(n+1) from collections import defaultdict d = defaultdict(int) 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 d[n//i] += c ans = 0 for k,v in d.items(): ans += isqrt(k)*v print(ans)