結果

問題 No.1653 Squarefree
ユーザー kozykozy
提出日時 2021-08-20 23:02:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 141,056 KB
最終ジャッジ日時 2024-04-22 09:20:25
合計ジャッジ時間 9,496 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 256 ms
141,024 KB
testcase_01 AC 87 ms
59,524 KB
testcase_02 AC 63 ms
59,392 KB
testcase_03 AC 97 ms
62,976 KB
testcase_04 AC 89 ms
59,648 KB
testcase_05 AC 86 ms
60,032 KB
testcase_06 AC 88 ms
59,904 KB
testcase_07 AC 86 ms
59,520 KB
testcase_08 AC 88 ms
60,032 KB
testcase_09 AC 87 ms
59,776 KB
testcase_10 AC 87 ms
59,776 KB
testcase_11 AC 198 ms
140,672 KB
testcase_12 AC 198 ms
140,928 KB
testcase_13 AC 250 ms
140,800 KB
testcase_14 AC 239 ms
140,672 KB
testcase_15 AC 239 ms
140,648 KB
testcase_16 AC 251 ms
140,544 KB
testcase_17 AC 247 ms
140,544 KB
testcase_18 AC 240 ms
140,800 KB
testcase_19 AC 241 ms
140,800 KB
testcase_20 AC 240 ms
140,808 KB
testcase_21 AC 242 ms
140,732 KB
testcase_22 AC 244 ms
140,672 KB
testcase_23 AC 250 ms
140,884 KB
testcase_24 AC 239 ms
140,984 KB
testcase_25 AC 255 ms
140,416 KB
testcase_26 AC 245 ms
140,672 KB
testcase_27 AC 241 ms
140,416 KB
testcase_28 AC 247 ms
141,056 KB
testcase_29 AC 241 ms
140,416 KB
testcase_30 AC 239 ms
140,672 KB
testcase_31 AC 242 ms
140,908 KB
testcase_32 AC 244 ms
140,416 KB
testcase_33 AC 243 ms
140,672 KB
testcase_34 AC 249 ms
140,672 KB
testcase_35 AC 249 ms
140,544 KB
testcase_36 AC 91 ms
59,392 KB
testcase_37 AC 89 ms
59,520 KB
testcase_38 AC 90 ms
59,520 KB
testcase_39 AC 89 ms
59,648 KB
testcase_40 AC 89 ms
59,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=set()
L,R=map(int,input().split())
M=10**6
for i in range(2,M+1):
  s=i**2
  l=s+(s*((L-1)//s))
  for j in range(l,R+1,s):
    S.add(j)
for a in range(1,M+1):
  l,r=((L-1)//a)+1,R//a
  if l>r:
    continue
  #l~rにある平方数
  s=int(l**0.5)-2
  while True:
    if s<=1:
      s=2
    if l<=s**2<=r:
      S.add((s**2)*a)
      s+=1
    elif s**2<l:
      s+=1
    else:
      break
print(R-L+1-len(S))
0