結果
問題 | No.1653 Squarefree |
ユーザー |
|
提出日時 | 2021-08-20 22:58:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 741 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,520 KB |
実行使用メモリ | 90,628 KB |
最終ジャッジ日時 | 2024-10-14 05:58:23 |
合計ジャッジ時間 | 5,262 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 1 TLE * 1 -- * 29 |
ソースコード
import sysinput = lambda : sys.stdin.readline().rstrip()sys.setrecursionlimit(2*10**5+10)write = lambda x: sys.stdout.write(x+"\n")debug = lambda x: sys.stderr.write(x+"\n")writef = lambda x: print("{:.12f}".format(x))def isqrt(n):"""x*x<=nなる最大のx"""x,y = n, (n+1)//2while y<x:x,y = y, (y + n//y) // 2return xl,r = list(map(int, input().split()))ok = [1]*(r-l+1)# ok[i] : l+ifor i in range(2, 1010):ii = i*ill = ((l+ii-1)//ii)*iifor k in range(ll, r+1, ii):ok[k-l] = 0for i in range(1,r-l+1):ir = r//ik = isqrt(ir)kk = k*kif k>1 and l<=i*kk<=r:while i*kk-l>=0:ok[i*kk-l] = 0i -= 1ans = sum(ok)print(ans)