結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー TawaraTawara
提出日時 2016-08-05 22:48:09
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 223 ms / 1,000 ms
コード長 408 bytes
コンパイル時間 1,490 ms
コンパイル使用メモリ 77,556 KB
実行使用メモリ 117,512 KB
最終ジャッジ日時 2023-08-22 03:28:56
合計ジャッジ時間 5,946 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
76,364 KB
testcase_01 AC 73 ms
76,064 KB
testcase_02 AC 75 ms
76,544 KB
testcase_03 AC 99 ms
79,832 KB
testcase_04 AC 73 ms
76,252 KB
testcase_05 AC 73 ms
76,360 KB
testcase_06 AC 73 ms
76,376 KB
testcase_07 AC 73 ms
76,456 KB
testcase_08 AC 73 ms
76,228 KB
testcase_09 AC 72 ms
76,244 KB
testcase_10 AC 72 ms
76,376 KB
testcase_11 AC 72 ms
76,228 KB
testcase_12 AC 72 ms
76,372 KB
testcase_13 AC 72 ms
76,212 KB
testcase_14 AC 75 ms
77,408 KB
testcase_15 AC 71 ms
76,224 KB
testcase_16 AC 72 ms
76,160 KB
testcase_17 AC 72 ms
76,460 KB
testcase_18 AC 71 ms
76,364 KB
testcase_19 AC 88 ms
82,204 KB
testcase_20 AC 108 ms
90,416 KB
testcase_21 AC 73 ms
76,372 KB
testcase_22 AC 74 ms
76,432 KB
testcase_23 AC 74 ms
76,384 KB
testcase_24 AC 73 ms
76,640 KB
testcase_25 AC 129 ms
98,088 KB
testcase_26 AC 73 ms
76,356 KB
testcase_27 AC 72 ms
76,436 KB
testcase_28 AC 74 ms
76,380 KB
testcase_29 AC 75 ms
76,368 KB
testcase_30 AC 73 ms
76,252 KB
testcase_31 AC 72 ms
76,228 KB
testcase_32 AC 107 ms
88,436 KB
testcase_33 AC 223 ms
117,496 KB
testcase_34 AC 214 ms
117,512 KB
testcase_35 AC 131 ms
96,308 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 < 5:
	print 0
	quit()
prime = sieve(L/(N-1)+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