結果

問題 No.1653 Squarefree
ユーザー kozykozy
提出日時 2021-08-20 23:02:15
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 141,912 KB
最終ジャッジ日時 2023-08-04 11:43:33
合計ジャッジ時間 12,284 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 301 ms
141,680 KB
testcase_01 AC 122 ms
76,540 KB
testcase_02 AC 95 ms
76,200 KB
testcase_03 AC 128 ms
76,400 KB
testcase_04 AC 121 ms
76,628 KB
testcase_05 AC 120 ms
76,256 KB
testcase_06 AC 120 ms
76,596 KB
testcase_07 AC 120 ms
76,424 KB
testcase_08 AC 119 ms
76,568 KB
testcase_09 AC 119 ms
76,476 KB
testcase_10 AC 123 ms
76,544 KB
testcase_11 AC 215 ms
141,832 KB
testcase_12 AC 206 ms
141,724 KB
testcase_13 AC 309 ms
141,592 KB
testcase_14 AC 303 ms
141,576 KB
testcase_15 AC 302 ms
141,636 KB
testcase_16 AC 302 ms
141,728 KB
testcase_17 AC 304 ms
141,640 KB
testcase_18 AC 301 ms
141,728 KB
testcase_19 AC 302 ms
141,792 KB
testcase_20 AC 300 ms
141,680 KB
testcase_21 AC 307 ms
141,580 KB
testcase_22 AC 303 ms
141,724 KB
testcase_23 AC 312 ms
141,648 KB
testcase_24 AC 304 ms
141,652 KB
testcase_25 AC 305 ms
141,644 KB
testcase_26 AC 308 ms
141,856 KB
testcase_27 AC 309 ms
141,560 KB
testcase_28 AC 305 ms
141,596 KB
testcase_29 AC 300 ms
141,864 KB
testcase_30 AC 299 ms
141,860 KB
testcase_31 AC 304 ms
141,636 KB
testcase_32 AC 309 ms
141,912 KB
testcase_33 AC 309 ms
141,668 KB
testcase_34 AC 303 ms
141,860 KB
testcase_35 AC 312 ms
141,568 KB
testcase_36 AC 123 ms
76,352 KB
testcase_37 AC 124 ms
76,496 KB
testcase_38 AC 120 ms
76,668 KB
testcase_39 AC 120 ms
76,488 KB
testcase_40 AC 122 ms
76,548 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