結果

問題 No.1653 Squarefree
ユーザー kasashimataigakasashimataiga
提出日時 2022-03-29 00:27:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 405 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 244,160 KB
最終ジャッジ日時 2023-08-07 11:51:06
合計ジャッジ時間 14,105 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 351 ms
243,740 KB
testcase_01 AC 153 ms
76,980 KB
testcase_02 AC 152 ms
76,432 KB
testcase_03 AC 194 ms
76,636 KB
testcase_04 AC 151 ms
76,680 KB
testcase_05 AC 150 ms
76,504 KB
testcase_06 AC 150 ms
76,784 KB
testcase_07 AC 151 ms
76,664 KB
testcase_08 AC 150 ms
76,880 KB
testcase_09 AC 150 ms
76,616 KB
testcase_10 AC 150 ms
76,624 KB
testcase_11 AC 345 ms
243,692 KB
testcase_12 AC 340 ms
243,544 KB
testcase_13 AC 348 ms
243,976 KB
testcase_14 AC 346 ms
243,860 KB
testcase_15 AC 346 ms
244,160 KB
testcase_16 AC 339 ms
243,688 KB
testcase_17 AC 346 ms
243,960 KB
testcase_18 AC 342 ms
243,732 KB
testcase_19 AC 340 ms
243,840 KB
testcase_20 AC 343 ms
243,800 KB
testcase_21 AC 342 ms
244,044 KB
testcase_22 AC 344 ms
243,808 KB
testcase_23 AC 341 ms
243,724 KB
testcase_24 AC 342 ms
243,860 KB
testcase_25 AC 340 ms
243,884 KB
testcase_26 AC 358 ms
243,716 KB
testcase_27 AC 351 ms
243,892 KB
testcase_28 AC 342 ms
243,884 KB
testcase_29 AC 342 ms
243,980 KB
testcase_30 AC 336 ms
243,872 KB
testcase_31 AC 339 ms
243,888 KB
testcase_32 AC 345 ms
243,740 KB
testcase_33 AC 340 ms
244,024 KB
testcase_34 AC 343 ms
243,796 KB
testcase_35 AC 344 ms
243,864 KB
testcase_36 AC 191 ms
76,800 KB
testcase_37 AC 192 ms
76,620 KB
testcase_38 AC 192 ms
76,552 KB
testcase_39 AC 198 ms
76,716 KB
testcase_40 AC 197 ms
76,980 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