結果

問題 No.1653 Squarefree
ユーザー shobonvipshobonvip
提出日時 2022-03-30 17:41:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 544 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 99,716 KB
最終ジャッジ日時 2024-04-27 07:42:47
合計ジャッジ時間 6,266 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 96 ms
74,524 KB
testcase_02 AC 101 ms
73,328 KB
testcase_03 AC 94 ms
73,704 KB
testcase_04 AC 91 ms
74,168 KB
testcase_05 AC 94 ms
73,940 KB
testcase_06 AC 94 ms
73,284 KB
testcase_07 AC 93 ms
74,192 KB
testcase_08 AC 101 ms
73,408 KB
testcase_09 AC 96 ms
74,796 KB
testcase_10 AC 102 ms
74,164 KB
testcase_11 AC 139 ms
99,672 KB
testcase_12 AC 127 ms
99,716 KB
testcase_13 AC 119 ms
95,012 KB
testcase_14 AC 126 ms
95,888 KB
testcase_15 AC 125 ms
97,452 KB
testcase_16 AC 122 ms
97,232 KB
testcase_17 AC 123 ms
96,316 KB
testcase_18 AC 126 ms
95,700 KB
testcase_19 AC 117 ms
95,728 KB
testcase_20 AC 148 ms
97,576 KB
testcase_21 AC 129 ms
97,528 KB
testcase_22 AC 126 ms
95,888 KB
testcase_23 AC 119 ms
95,872 KB
testcase_24 AC 120 ms
94,992 KB
testcase_25 AC 119 ms
96,908 KB
testcase_26 AC 119 ms
95,384 KB
testcase_27 AC 120 ms
95,456 KB
testcase_28 AC 118 ms
95,808 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 118 ms
96,592 KB
testcase_32 AC 123 ms
95,500 KB
testcase_33 AC 115 ms
95,104 KB
testcase_34 AC 118 ms
96,676 KB
testcase_35 AC 122 ms
97,480 KB
testcase_36 AC 92 ms
74,204 KB
testcase_37 WA -
testcase_38 AC 88 ms
73,212 KB
testcase_39 AC 89 ms
73,968 KB
testcase_40 AC 94 ms
73,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def sqrt(n):
	ins = math.floor(math.sqrt(n))
	if ins**2 > n:
		ins -= 1
	return ins

l,r = map(int,input().split())
v = [l+i for i in range(r-l+1)]
w = [0 for i in range(r-l+1)]
		
dp = [0 for i in range(10**6+1)]
for i in range(2, 10**6):
	if dp[i] == 0:
		#A/(i**2) = integer
		for j in range((l+i**2-1)//(i**2), r//(i**2)+1):
			w[j*(i**2) - l] = 1
		#A/i = square
		for j in range(max(2,sqrt(l//i)+1), sqrt(r//i)+1):
			#print(j**2 * i)
			w[i*(j**2) - l] = 1
		for j in range(i, 10**6+1, i):
			dp[j] = 1

print(r-l+1 - sum(w))
0