結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー pluto77pluto77
提出日時 2016-10-24 11:21:11
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 168 ms / 1,000 ms
コード長 425 bytes
コンパイル時間 1,735 ms
コンパイル使用メモリ 77,584 KB
実行使用メモリ 126,904 KB
最終ジャッジ日時 2023-08-22 06:41:21
合計ジャッジ時間 7,165 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,676 KB
testcase_01 AC 78 ms
76,816 KB
testcase_02 AC 71 ms
76,216 KB
testcase_03 AC 90 ms
79,740 KB
testcase_04 AC 73 ms
76,384 KB
testcase_05 AC 74 ms
77,052 KB
testcase_06 AC 73 ms
76,972 KB
testcase_07 AC 73 ms
77,128 KB
testcase_08 AC 73 ms
76,248 KB
testcase_09 AC 74 ms
76,704 KB
testcase_10 AC 72 ms
76,264 KB
testcase_11 AC 72 ms
76,508 KB
testcase_12 AC 71 ms
76,396 KB
testcase_13 AC 72 ms
76,984 KB
testcase_14 AC 73 ms
76,904 KB
testcase_15 AC 72 ms
76,508 KB
testcase_16 AC 73 ms
76,924 KB
testcase_17 AC 73 ms
76,788 KB
testcase_18 AC 73 ms
76,624 KB
testcase_19 AC 89 ms
83,348 KB
testcase_20 AC 102 ms
92,820 KB
testcase_21 AC 72 ms
76,388 KB
testcase_22 AC 72 ms
76,684 KB
testcase_23 AC 73 ms
76,848 KB
testcase_24 AC 72 ms
76,864 KB
testcase_25 AC 118 ms
102,392 KB
testcase_26 AC 73 ms
76,948 KB
testcase_27 AC 73 ms
76,736 KB
testcase_28 AC 72 ms
77,112 KB
testcase_29 AC 72 ms
76,636 KB
testcase_30 AC 73 ms
76,412 KB
testcase_31 AC 73 ms
76,644 KB
testcase_32 AC 98 ms
90,796 KB
testcase_33 AC 161 ms
126,652 KB
testcase_34 AC 168 ms
126,904 KB
testcase_35 AC 112 ms
101,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_407
import math

def primelist(n):
 if n==2: return [2]
 elif n<2: return []
 s=range(3,n+1,2)
 mroot = n ** 0.5
 half=(n+1)/2-1
 i=0
 m=3
 while m <= mroot:
  if s[i]:
   j=(m*m-3)/2
   s[j]=0
   while j<half:
	s[j]=0
	j+=m
  i=i+1
  m=2*i+3
 return [2]+[x for x in s if x]

n,l=map(int,raw_input().split())
plist=primelist(l/(n-1))
cnt=0
for p in plist:
 if l-(n-1)*p+1>0:
  cnt+=l-(n-1)*p+1
 else:
  break
print cnt
0