結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー pluto77pluto77
提出日時 2016-10-24 11:21:11
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 196 ms / 1,000 ms
コード長 425 bytes
コンパイル時間 2,231 ms
コンパイル使用メモリ 76,544 KB
実行使用メモリ 125,312 KB
最終ジャッジ日時 2024-12-16 01:45:36
合計ジャッジ時間 6,642 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
75,392 KB
testcase_01 AC 84 ms
75,264 KB
testcase_02 AC 80 ms
75,136 KB
testcase_03 AC 117 ms
77,824 KB
testcase_04 AC 82 ms
75,520 KB
testcase_05 AC 80 ms
75,264 KB
testcase_06 AC 81 ms
75,776 KB
testcase_07 AC 81 ms
75,648 KB
testcase_08 AC 83 ms
75,008 KB
testcase_09 AC 80 ms
75,264 KB
testcase_10 AC 81 ms
75,648 KB
testcase_11 AC 84 ms
75,008 KB
testcase_12 AC 84 ms
75,520 KB
testcase_13 AC 84 ms
75,904 KB
testcase_14 AC 86 ms
75,392 KB
testcase_15 AC 85 ms
75,392 KB
testcase_16 AC 85 ms
75,648 KB
testcase_17 AC 83 ms
75,520 KB
testcase_18 AC 85 ms
75,264 KB
testcase_19 AC 101 ms
81,952 KB
testcase_20 AC 117 ms
91,136 KB
testcase_21 AC 84 ms
75,264 KB
testcase_22 AC 80 ms
75,264 KB
testcase_23 AC 85 ms
75,904 KB
testcase_24 AC 84 ms
75,520 KB
testcase_25 AC 130 ms
100,992 KB
testcase_26 AC 88 ms
75,520 KB
testcase_27 AC 88 ms
75,520 KB
testcase_28 AC 86 ms
75,680 KB
testcase_29 AC 87 ms
75,648 KB
testcase_30 AC 86 ms
75,776 KB
testcase_31 AC 87 ms
75,776 KB
testcase_32 AC 111 ms
89,344 KB
testcase_33 AC 196 ms
125,056 KB
testcase_34 AC 194 ms
125,312 KB
testcase_35 AC 131 ms
99,840 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