結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー TawaraTawara
提出日時 2016-08-05 22:43:12
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 406 bytes
コンパイル時間 566 ms
コンパイル使用メモリ 6,784 KB
実行使用メモリ 45,440 KB
最終ジャッジ日時 2024-04-24 15:55:35
合計ジャッジ時間 6,773 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,272 KB
testcase_01 AC 10 ms
6,272 KB
testcase_02 AC 9 ms
6,400 KB
testcase_03 AC 38 ms
7,296 KB
testcase_04 AC 10 ms
6,272 KB
testcase_05 AC 10 ms
6,272 KB
testcase_06 AC 11 ms
6,272 KB
testcase_07 AC 10 ms
6,400 KB
testcase_08 AC 10 ms
6,272 KB
testcase_09 AC 10 ms
6,272 KB
testcase_10 AC 10 ms
6,400 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 10 ms
6,272 KB
testcase_14 AC 10 ms
6,272 KB
testcase_15 RE -
testcase_16 AC 11 ms
6,272 KB
testcase_17 AC 10 ms
6,272 KB
testcase_18 AC 10 ms
6,400 KB
testcase_19 AC 114 ms
9,984 KB
testcase_20 AC 355 ms
18,048 KB
testcase_21 AC 11 ms
6,400 KB
testcase_22 AC 11 ms
6,400 KB
testcase_23 AC 10 ms
6,272 KB
testcase_24 AC 10 ms
6,400 KB
testcase_25 AC 624 ms
25,728 KB
testcase_26 AC 11 ms
6,272 KB
testcase_27 RE -
testcase_28 AC 10 ms
6,272 KB
testcase_29 AC 10 ms
6,272 KB
testcase_30 AC 10 ms
6,144 KB
testcase_31 AC 10 ms
6,272 KB
testcase_32 AC 266 ms
15,872 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 561 ms
23,936 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 check
N,L = map(int,raw_input().split())
if L < 3:
	print 0
	quit()
prime = sieve(L/(N-1))
M = 0
for i in xrange(2,L/(N-1)+1):
	if prime[i] == 0:
		continue
	if i * (N-1) <= L:
		M += L+1 - i*(N-1)
print M
0