結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー tookunn_1213
提出日時 2016-08-06 00:42:07
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 457 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 130,356 KB
最終ジャッジ日時 2024-11-07 00:24:34
合計ジャッジ時間 4,537 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4 RE * 1
other AC * 27 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

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