結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー tookunn_1213
提出日時 2016-08-06 00:39:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 460 ms / 1,000 ms
コード長 446 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 81,940 KB
実行使用メモリ 130,696 KB
最終ジャッジ日時 2024-11-07 00:22:18
合計ジャッジ時間 8,509 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N,L = map(int,input().split())
def getPrimes():
	isPrime = [True for i in range(4999999 + 1)]
	isPrime[0] = isPrime[1] = False
	primes = []
	for i in range(2,4999999 + 1):
		if not isPrime[i]:
			continue
		if L < i * (N - 1):
			break
		for j in range(i * 2,4999999 + 1,i):
			isPrime[j] = False
		primes.append(i)
	return primes
primes = getPrimes()
ans = 0
for p in primes:
	if L < p * (N - 1):
		break
	ans += (L - p * (N - 1)) + 1
print(ans)
0