結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー nebukuro09nebukuro09
提出日時 2016-10-19 14:16:42
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 772 ms / 1,000 ms
コード長 397 bytes
コンパイル時間 2,275 ms
コンパイル使用メモリ 76,592 KB
実行使用メモリ 202,152 KB
最終ジャッジ日時 2024-12-16 01:16:08
合計ジャッジ時間 10,682 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
75,556 KB
testcase_01 AC 84 ms
75,296 KB
testcase_02 AC 82 ms
75,400 KB
testcase_03 AC 141 ms
89,640 KB
testcase_04 AC 83 ms
75,520 KB
testcase_05 AC 772 ms
198,688 KB
testcase_06 AC 437 ms
143,988 KB
testcase_07 AC 84 ms
75,516 KB
testcase_08 AC 85 ms
75,804 KB
testcase_09 AC 83 ms
75,800 KB
testcase_10 AC 86 ms
76,088 KB
testcase_11 AC 81 ms
76,024 KB
testcase_12 AC 88 ms
77,048 KB
testcase_13 AC 87 ms
76,960 KB
testcase_14 AC 91 ms
77,448 KB
testcase_15 AC 86 ms
75,672 KB
testcase_16 AC 87 ms
76,408 KB
testcase_17 AC 89 ms
76,048 KB
testcase_18 AC 88 ms
76,448 KB
testcase_19 AC 135 ms
89,784 KB
testcase_20 AC 280 ms
116,312 KB
testcase_21 AC 157 ms
93,468 KB
testcase_22 AC 145 ms
91,496 KB
testcase_23 AC 193 ms
101,588 KB
testcase_24 AC 292 ms
116,468 KB
testcase_25 AC 420 ms
141,356 KB
testcase_26 AC 422 ms
141,360 KB
testcase_27 AC 125 ms
86,020 KB
testcase_28 AC 250 ms
104,392 KB
testcase_29 AC 414 ms
139,968 KB
testcase_30 AC 132 ms
87,772 KB
testcase_31 AC 360 ms
128,232 KB
testcase_32 AC 445 ms
140,920 KB
testcase_33 AC 760 ms
202,152 KB
testcase_34 AC 764 ms
202,052 KB
testcase_35 AC 697 ms
194,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_table(n):
  L = [True for _ in xrange(n + 1)]
  i = 2
  while i * i <= n:
    if L[i]:
      j = i + i
      while j <= n:
        L[j] = False
        j += i
    i += 1

  table = [i for i in xrange(n + 1) if L[i] and i >= 2]
  return table

N, L = map(int, raw_input().split())
ans = 0
for p in prime_table(L):
    a = L-(N-1)*p + 1
    if a <= 0:
        break
    ans += a
print ans
0