結果
| 問題 | No.192 合成数 |
| コンテスト | |
| ユーザー |
TakoKurage
|
| 提出日時 | 2020-02-24 16:40:53 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 2,000 ms |
| コード長 | 425 bytes |
| 記録 | |
| コンパイル時間 | 730 ms |
| コンパイル使用メモリ | 20,956 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-04-28 16:46:21 |
| 合計ジャッジ時間 | 4,565 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
def primes(n):
memo = [True] * (n + 1)
i = 2
while i * i <= n:
if memo[i]:
j = i << 1
while j <= n:
memo[j] = False
j += i
i += 1
return {i for i in range(n + 1) if memo[i] and i >= 2}
N = int(input())
P = primes(N + 100)
l, r = N - 100, N + 100
for i in range(l, r + 1):
if i != 1 and i not in P:
print(i)
quit()
TakoKurage