結果

問題 No.1653 Squarefree
ユーザー ああいいああいい
提出日時 2022-03-12 11:46:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 757 bytes
コンパイル時間 1,362 ms
コンパイル使用メモリ 86,652 KB
実行使用メモリ 93,412 KB
最終ジャッジ日時 2023-10-14 23:55:38
合計ジャッジ時間 16,272 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 451 ms
93,036 KB
testcase_01 AC 122 ms
83,932 KB
testcase_02 AC 123 ms
83,900 KB
testcase_03 AC 125 ms
84,116 KB
testcase_04 AC 120 ms
83,984 KB
testcase_05 AC 122 ms
83,944 KB
testcase_06 AC 123 ms
84,036 KB
testcase_07 AC 122 ms
84,096 KB
testcase_08 AC 123 ms
84,140 KB
testcase_09 AC 126 ms
84,004 KB
testcase_10 AC 126 ms
84,068 KB
testcase_11 AC 263 ms
92,780 KB
testcase_12 AC 263 ms
92,644 KB
testcase_13 AC 443 ms
92,700 KB
testcase_14 AC 448 ms
93,316 KB
testcase_15 AC 447 ms
93,184 KB
testcase_16 AC 445 ms
93,168 KB
testcase_17 AC 436 ms
93,144 KB
testcase_18 AC 442 ms
92,764 KB
testcase_19 AC 444 ms
93,204 KB
testcase_20 AC 436 ms
93,172 KB
testcase_21 AC 444 ms
93,044 KB
testcase_22 AC 438 ms
93,016 KB
testcase_23 AC 431 ms
92,884 KB
testcase_24 AC 443 ms
93,128 KB
testcase_25 AC 429 ms
93,264 KB
testcase_26 AC 432 ms
93,144 KB
testcase_27 AC 432 ms
92,756 KB
testcase_28 AC 441 ms
93,148 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 436 ms
93,180 KB
testcase_32 AC 436 ms
93,276 KB
testcase_33 WA -
testcase_34 AC 444 ms
93,192 KB
testcase_35 AC 441 ms
93,140 KB
testcase_36 AC 126 ms
84,048 KB
testcase_37 AC 126 ms
83,992 KB
testcase_38 AC 125 ms
83,900 KB
testcase_39 AC 125 ms
83,764 KB
testcase_40 AC 126 ms
84,052 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 mid * mid == 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