結果

問題 No.1653 Squarefree
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-08-20 23:03:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 858 ms / 2,000 ms
コード長 561 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 244,924 KB
最終ジャッジ日時 2023-08-04 11:44:58
合計ジャッジ時間 28,931 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 839 ms
244,608 KB
testcase_01 AC 269 ms
77,372 KB
testcase_02 AC 275 ms
77,368 KB
testcase_03 AC 290 ms
77,432 KB
testcase_04 AC 273 ms
77,432 KB
testcase_05 AC 279 ms
77,436 KB
testcase_06 AC 277 ms
77,264 KB
testcase_07 AC 282 ms
77,420 KB
testcase_08 AC 277 ms
77,560 KB
testcase_09 AC 271 ms
77,416 KB
testcase_10 AC 277 ms
77,452 KB
testcase_11 AC 510 ms
199,308 KB
testcase_12 AC 503 ms
199,328 KB
testcase_13 AC 773 ms
214,224 KB
testcase_14 AC 785 ms
244,584 KB
testcase_15 AC 858 ms
244,600 KB
testcase_16 AC 788 ms
244,632 KB
testcase_17 AC 798 ms
244,536 KB
testcase_18 AC 796 ms
244,548 KB
testcase_19 AC 797 ms
244,624 KB
testcase_20 AC 803 ms
244,568 KB
testcase_21 AC 784 ms
244,548 KB
testcase_22 AC 793 ms
244,872 KB
testcase_23 AC 792 ms
244,736 KB
testcase_24 AC 791 ms
244,540 KB
testcase_25 AC 786 ms
244,924 KB
testcase_26 AC 797 ms
214,060 KB
testcase_27 AC 801 ms
244,432 KB
testcase_28 AC 800 ms
214,004 KB
testcase_29 AC 796 ms
244,492 KB
testcase_30 AC 786 ms
244,492 KB
testcase_31 AC 789 ms
244,540 KB
testcase_32 AC 795 ms
244,604 KB
testcase_33 AC 799 ms
244,612 KB
testcase_34 AC 799 ms
244,628 KB
testcase_35 AC 795 ms
244,552 KB
testcase_36 AC 623 ms
77,344 KB
testcase_37 AC 619 ms
77,348 KB
testcase_38 AC 616 ms
77,624 KB
testcase_39 AC 619 ms
77,112 KB
testcase_40 AC 619 ms
77,484 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