結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー nebukuro09nebukuro09
提出日時 2016-10-19 14:16:42
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 691 ms / 1,000 ms
コード長 397 bytes
コンパイル時間 1,848 ms
コンパイル使用メモリ 77,236 KB
実行使用メモリ 203,504 KB
最終ジャッジ日時 2023-08-22 06:22:13
合計ジャッジ時間 10,685 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,392 KB
testcase_01 AC 74 ms
76,420 KB
testcase_02 AC 74 ms
76,276 KB
testcase_03 AC 124 ms
90,772 KB
testcase_04 AC 74 ms
76,432 KB
testcase_05 AC 689 ms
199,600 KB
testcase_06 AC 380 ms
144,628 KB
testcase_07 AC 75 ms
76,392 KB
testcase_08 AC 76 ms
76,160 KB
testcase_09 AC 76 ms
76,404 KB
testcase_10 AC 76 ms
76,908 KB
testcase_11 AC 74 ms
76,512 KB
testcase_12 AC 83 ms
78,940 KB
testcase_13 AC 81 ms
78,460 KB
testcase_14 AC 83 ms
78,772 KB
testcase_15 AC 75 ms
76,404 KB
testcase_16 AC 80 ms
78,380 KB
testcase_17 AC 82 ms
78,760 KB
testcase_18 AC 81 ms
78,196 KB
testcase_19 AC 125 ms
91,172 KB
testcase_20 AC 220 ms
117,352 KB
testcase_21 AC 137 ms
94,768 KB
testcase_22 AC 128 ms
91,944 KB
testcase_23 AC 170 ms
102,644 KB
testcase_24 AC 225 ms
117,268 KB
testcase_25 AC 367 ms
143,064 KB
testcase_26 AC 372 ms
142,748 KB
testcase_27 AC 112 ms
87,108 KB
testcase_28 AC 180 ms
105,828 KB
testcase_29 AC 361 ms
141,236 KB
testcase_30 AC 122 ms
89,176 KB
testcase_31 AC 288 ms
129,376 KB
testcase_32 AC 383 ms
142,152 KB
testcase_33 AC 691 ms
203,292 KB
testcase_34 AC 691 ms
203,504 KB
testcase_35 AC 636 ms
195,508 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