結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー TawaraTawara
提出日時 2016-08-06 00:00:40
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 358 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 56,576 KB
最終ジャッジ日時 2024-04-24 20:01:22
合計ジャッジ時間 5,397 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,400 KB
testcase_01 AC 9 ms
6,400 KB
testcase_02 AC 9 ms
6,400 KB
testcase_03 AC 27 ms
7,808 KB
testcase_04 AC 9 ms
6,528 KB
testcase_05 AC 10 ms
6,400 KB
testcase_06 AC 9 ms
6,400 KB
testcase_07 AC 10 ms
6,400 KB
testcase_08 AC 9 ms
6,400 KB
testcase_09 AC 9 ms
6,400 KB
testcase_10 AC 10 ms
6,272 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 10 ms
6,400 KB
testcase_14 AC 9 ms
6,400 KB
testcase_15 RE -
testcase_16 AC 9 ms
6,528 KB
testcase_17 AC 9 ms
6,400 KB
testcase_18 AC 10 ms
6,400 KB
testcase_19 AC 81 ms
11,520 KB
testcase_20 AC 251 ms
21,504 KB
testcase_21 AC 10 ms
6,400 KB
testcase_22 AC 11 ms
6,400 KB
testcase_23 AC 10 ms
6,400 KB
testcase_24 AC 9 ms
6,400 KB
testcase_25 AC 475 ms
31,616 KB
testcase_26 AC 10 ms
6,272 KB
testcase_27 RE -
testcase_28 AC 9 ms
6,272 KB
testcase_29 AC 10 ms
6,400 KB
testcase_30 AC 10 ms
6,272 KB
testcase_31 AC 9 ms
6,272 KB
testcase_32 AC 200 ms
18,944 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 403 ms
29,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def sieve (n):
	check = [1]*(n+1)
	check[0] = check[1] = 0
	for d in xrange(2,int(math.sqrt(n))+1):
		if check[d] == 0: continue
		for comp in xrange(d*2,n+1,d):
			check[comp] = 0
	return [i for i in xrange(n+1) if check[i]]
N,L = map(int,raw_input().split())
if L < 5:
	print 0
	quit()
M = 0
for p in sieve(L/(N-1)):
	M += L+1 - p*(N-1)
print M
0