結果
問題 |
No.407 鴨等素数間隔列の数え上げ
|
ユーザー |
![]() |
提出日時 | 2020-07-09 10:02:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 324 ms / 1,000 ms |
コード長 | 655 bytes |
コンパイル時間 | 264 ms |
コンパイル使用メモリ | 82,288 KB |
実行使用メモリ | 114,516 KB |
最終ジャッジ日時 | 2024-10-06 10:57:10 |
合計ジャッジ時間 | 3,644 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 31 |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] def solve(): lim = l // (n - 1) + 1 isprime = [True] * (lim + 1) ans = 0 for d in range(2, lim): if not isprime[d]: continue for j in range(d ** 2, lim + 1, d): isprime[j] = False ans += l - d * (n - 1) + 1 print(ans) n,l=MI() solve()