結果
問題 | No.1653 Squarefree |
ユーザー |
|
提出日時 | 2021-08-20 22:59:38 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 776 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 84,096 KB |
最終ジャッジ日時 | 2024-10-14 06:08:58 |
合計ジャッジ時間 | 16,204 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 25 |
ソースコード
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 kk<=10**6:continueif k>1 and l<=i*kk<=r:while i*kk-l>=0:ok[i*kk-l] = 0i -= 1ans = sum(ok)print(ans)