結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー rin204
提出日時 2022-01-20 03:03:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 658 ms / 1,000 ms
コード長 364 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 139,648 KB
最終ジャッジ日時 2024-11-23 14:14:27
合計ジャッジ時間 22,032 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N = 10000010
isprime = [True] * N
isprime[0] = isprime[1] = False
for i in range(2, int(N ** 0.5 + 1)):
    if not isprime[i]:
        continue
    for j in range(i * i, N, i):
        isprime[j] = False

n, l = map(int, input().split())
ans = 0
for d in range(l):
    if not isprime[d]:
        continue
    x = d * (n - 1)
    ans += max(0, l - x + 1)
print(ans)
0