結果

問題 No.1653 Squarefree
ユーザー kasashimataigakasashimataiga
提出日時 2022-03-29 00:27:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 384 ms / 2,000 ms
コード長 405 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 234,496 KB
最終ジャッジ日時 2024-04-25 05:42:24
合計ジャッジ時間 12,745 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 346 ms
231,780 KB
testcase_01 AC 115 ms
60,800 KB
testcase_02 AC 112 ms
60,672 KB
testcase_03 AC 127 ms
60,928 KB
testcase_04 AC 113 ms
61,440 KB
testcase_05 AC 114 ms
60,800 KB
testcase_06 AC 112 ms
60,928 KB
testcase_07 AC 112 ms
61,312 KB
testcase_08 AC 114 ms
60,928 KB
testcase_09 AC 112 ms
60,928 KB
testcase_10 AC 111 ms
60,800 KB
testcase_11 AC 381 ms
234,112 KB
testcase_12 AC 384 ms
234,496 KB
testcase_13 AC 343 ms
232,064 KB
testcase_14 AC 343 ms
232,064 KB
testcase_15 AC 347 ms
231,808 KB
testcase_16 AC 342 ms
231,808 KB
testcase_17 AC 346 ms
231,808 KB
testcase_18 AC 347 ms
232,064 KB
testcase_19 AC 346 ms
231,936 KB
testcase_20 AC 343 ms
232,064 KB
testcase_21 AC 337 ms
231,936 KB
testcase_22 AC 349 ms
231,936 KB
testcase_23 AC 347 ms
231,904 KB
testcase_24 AC 341 ms
231,808 KB
testcase_25 AC 344 ms
231,936 KB
testcase_26 AC 347 ms
231,936 KB
testcase_27 AC 344 ms
231,680 KB
testcase_28 AC 344 ms
231,680 KB
testcase_29 AC 350 ms
231,680 KB
testcase_30 AC 346 ms
231,680 KB
testcase_31 AC 348 ms
232,060 KB
testcase_32 AC 351 ms
232,064 KB
testcase_33 AC 345 ms
231,936 KB
testcase_34 AC 350 ms
231,680 KB
testcase_35 AC 351 ms
231,680 KB
testcase_36 AC 128 ms
60,928 KB
testcase_37 AC 126 ms
60,672 KB
testcase_38 AC 128 ms
60,800 KB
testcase_39 AC 129 ms
61,056 KB
testcase_40 AC 128 ms
60,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #



l,r=map(int,input().split())
dic=dict()
for i in range(l,r+1):
    dic[i]=1

for p in range(2,10**6+5):
    k=(l+p**2-1)//(p**2)
    while k*(p**2)<=r:
        dic[k*(p**2)]=0
        k+=1

for k in range(1,10**6+5):
    p=int((l//k)**0.5)
    while k*(p**2)<l:p+=1
    if p==1:p+=1
    while k*(p**2)<=r:
        dic[k*(p**2)]=0
        p+=1

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


0