結果

問題 No.1653 Squarefree
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-08-20 23:03:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 750 ms / 2,000 ms
コード長 561 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,336 KB
実行使用メモリ 243,712 KB
最終ジャッジ日時 2024-04-22 09:21:44
合計ジャッジ時間 25,391 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 741 ms
243,456 KB
testcase_01 AC 183 ms
76,044 KB
testcase_02 AC 176 ms
76,220 KB
testcase_03 AC 192 ms
76,036 KB
testcase_04 AC 178 ms
76,032 KB
testcase_05 AC 182 ms
76,160 KB
testcase_06 AC 184 ms
76,288 KB
testcase_07 AC 184 ms
76,032 KB
testcase_08 AC 182 ms
76,272 KB
testcase_09 AC 182 ms
76,160 KB
testcase_10 AC 182 ms
76,544 KB
testcase_11 AC 461 ms
196,976 KB
testcase_12 AC 453 ms
196,696 KB
testcase_13 AC 737 ms
243,300 KB
testcase_14 AC 750 ms
243,328 KB
testcase_15 AC 743 ms
243,328 KB
testcase_16 AC 743 ms
243,328 KB
testcase_17 AC 747 ms
243,328 KB
testcase_18 AC 741 ms
243,308 KB
testcase_19 AC 737 ms
243,456 KB
testcase_20 AC 735 ms
243,584 KB
testcase_21 AC 739 ms
243,712 KB
testcase_22 AC 743 ms
243,456 KB
testcase_23 AC 741 ms
243,328 KB
testcase_24 AC 734 ms
243,328 KB
testcase_25 AC 735 ms
243,308 KB
testcase_26 AC 739 ms
243,328 KB
testcase_27 AC 747 ms
243,200 KB
testcase_28 AC 736 ms
243,300 KB
testcase_29 AC 737 ms
243,484 KB
testcase_30 AC 740 ms
243,328 KB
testcase_31 AC 741 ms
243,456 KB
testcase_32 AC 741 ms
243,584 KB
testcase_33 AC 738 ms
243,288 KB
testcase_34 AC 746 ms
243,396 KB
testcase_35 AC 740 ms
243,400 KB
testcase_36 AC 526 ms
75,904 KB
testcase_37 AC 524 ms
76,184 KB
testcase_38 AC 527 ms
76,160 KB
testcase_39 AC 528 ms
76,168 KB
testcase_40 AC 527 ms
76,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline  # 文字列入力はするな!!
from _collections import defaultdict

l,r=map(int,input().split())

dic=defaultdict(lambda:1)

for cnt in range(1,1000000+10):
    a=(l/cnt)**0.5
    a=int(a)-1
    if a<0:a=0
    b=(r/cnt)**0.5
    b=int(b)+1
    for i in range(a,b+1):
        if i==1:continue
        if l<=cnt*(i**2)<=r:dic[cnt*(i**2)]=0


ans=0
for i in range(2,10**6+10):
    x=i**2
    k=l//x
    while k*x<=r:
        if l<=k*x<=r:dic[k*x]=0
        k+=1



for i in range(l,r+1):
    ans+=dic[i]
print(ans)



0