結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー yuki2006yuki2006
提出日時 2016-08-05 23:59:31
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 315 ms / 1,000 ms
コード長 330 bytes
コンパイル時間 1,242 ms
コンパイル使用メモリ 77,476 KB
実行使用メモリ 117,532 KB
最終ジャッジ日時 2023-08-22 04:28:23
合計ジャッジ時間 5,267 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,104 KB
testcase_01 AC 73 ms
76,368 KB
testcase_02 AC 73 ms
76,284 KB
testcase_03 AC 88 ms
79,544 KB
testcase_04 AC 72 ms
76,104 KB
testcase_05 AC 70 ms
76,480 KB
testcase_06 AC 74 ms
76,252 KB
testcase_07 AC 74 ms
76,588 KB
testcase_08 AC 75 ms
76,136 KB
testcase_09 AC 74 ms
76,096 KB
testcase_10 AC 73 ms
76,348 KB
testcase_11 AC 73 ms
76,240 KB
testcase_12 AC 74 ms
76,424 KB
testcase_13 AC 73 ms
76,368 KB
testcase_14 AC 76 ms
77,240 KB
testcase_15 AC 72 ms
76,372 KB
testcase_16 AC 74 ms
76,380 KB
testcase_17 AC 74 ms
76,136 KB
testcase_18 AC 74 ms
76,556 KB
testcase_19 AC 103 ms
82,292 KB
testcase_20 AC 144 ms
90,012 KB
testcase_21 AC 72 ms
76,300 KB
testcase_22 AC 72 ms
76,436 KB
testcase_23 AC 73 ms
76,248 KB
testcase_24 AC 72 ms
76,152 KB
testcase_25 AC 188 ms
97,920 KB
testcase_26 AC 75 ms
76,332 KB
testcase_27 AC 74 ms
76,448 KB
testcase_28 AC 72 ms
76,232 KB
testcase_29 AC 73 ms
76,460 KB
testcase_30 AC 73 ms
76,588 KB
testcase_31 AC 73 ms
76,328 KB
testcase_32 AC 131 ms
88,136 KB
testcase_33 AC 315 ms
117,532 KB
testcase_34 AC 315 ms
117,516 KB
testcase_35 AC 171 ms
96,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, L = map(int, raw_input().split())

right = L / (N - 1)

field = [True] * (right + 1)
i = 2
ans = 0
while i <= right:
    if field[i]:
        k = i * i
        while k <= right:
            field[k] = False
            k += i
        ans += L - i * (N - 1) + 1
    if i == 2:
        i += 1
    else:
        i += 2

print ans
0