結果

問題 No.1653 Squarefree
ユーザー ああいいああいい
提出日時 2022-03-12 11:49:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 401 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 1,384 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 93,280 KB
最終ジャッジ日時 2023-10-14 23:59:27
合計ジャッジ時間 13,604 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 398 ms
92,644 KB
testcase_01 AC 106 ms
83,784 KB
testcase_02 AC 107 ms
83,584 KB
testcase_03 AC 111 ms
83,984 KB
testcase_04 AC 111 ms
83,724 KB
testcase_05 AC 113 ms
84,028 KB
testcase_06 AC 109 ms
83,816 KB
testcase_07 AC 109 ms
83,912 KB
testcase_08 AC 115 ms
84,108 KB
testcase_09 AC 115 ms
83,864 KB
testcase_10 AC 113 ms
83,784 KB
testcase_11 AC 217 ms
92,368 KB
testcase_12 AC 205 ms
92,576 KB
testcase_13 AC 386 ms
92,648 KB
testcase_14 AC 374 ms
93,260 KB
testcase_15 AC 368 ms
93,256 KB
testcase_16 AC 381 ms
92,884 KB
testcase_17 AC 365 ms
92,860 KB
testcase_18 AC 385 ms
92,840 KB
testcase_19 AC 378 ms
93,056 KB
testcase_20 AC 401 ms
93,172 KB
testcase_21 AC 400 ms
93,132 KB
testcase_22 AC 381 ms
93,168 KB
testcase_23 AC 389 ms
92,764 KB
testcase_24 AC 372 ms
92,936 KB
testcase_25 AC 363 ms
92,924 KB
testcase_26 AC 377 ms
92,884 KB
testcase_27 AC 371 ms
92,600 KB
testcase_28 AC 388 ms
92,852 KB
testcase_29 AC 369 ms
92,716 KB
testcase_30 AC 374 ms
92,972 KB
testcase_31 AC 372 ms
92,928 KB
testcase_32 AC 372 ms
93,280 KB
testcase_33 AC 370 ms
92,692 KB
testcase_34 AC 365 ms
93,020 KB
testcase_35 AC 372 ms
92,892 KB
testcase_36 AC 108 ms
83,936 KB
testcase_37 AC 107 ms
83,784 KB
testcase_38 AC 107 ms
84,028 KB
testcase_39 AC 107 ms
83,912 KB
testcase_40 AC 111 ms
83,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

L,R = map(int,input().split())

C = 10 ** 6
dat = [0] * C
d = list(range(L,R+1))
for i in range(2,C):
    if dat[i] == 0:
        for j in range(2 * i,C,i):
            dat[j] = 1
        for j in range((L+i-1)//i,R//i+1):
            d[i * j - L] //= i
        now = i * i
        for j in range((L+now-1)//now,R//now+1):
            d[now*j-L] = 0
def check(x):
    if x <= 10 ** 12:return False
    start = 10 ** 6
    end = 10 ** 9 + 1
    while end - start > 1:
        mid = end + start >> 1
        if mid * mid <= x:
            start = mid
        else:
            end = mid
    return start * start == x
ans = 0
for i in d:
    if i == 0:continue
    if i == 1:
        ans += 1
        continue
    if check(i) == False:
        ans += 1
print(ans)
0