結果

問題 No.3101 Range Eratosthenes Query
ユーザー shobonvip
提出日時 2025-03-18 18:30:48
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 255 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 280,084 KB
最終ジャッジ日時 2025-03-18 18:30:58
合計ジャッジ時間 8,856 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

q=int(input())
for i in range(q):
	L,R=map(int,input().split())
	cnt = 0
	a = [0] * (R+1)
	i = L
	while i <= R:
		if a[i] == 1:
			i += 1
			continue
		else:
			cnt += 1
			v = 2*i
			while v <= R:
				a[v] = 1
				v += i
			i += 1
			continue
	print(cnt)
0