結果
問題 | No.1058 素敵な数 |
ユーザー | maspy |
提出日時 | 2020-05-22 22:08:28 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 516 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 44,596 KB |
最終ジャッジ日時 | 2024-04-15 16:59:18 |
合計ジャッジ時間 | 7,502 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
ソースコード
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(read()) U = 10**5 + 1000 is_prime = np.zeros(U, np.bool) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3, U, 2): if p * p > U: break if is_prime[p]: is_prime[p * p::p + p] = 0 primes = np.where(is_prime)[0] primes = primes[primes > 10**5] se = set(x * y for x in primes for y in primes) se.add(1) nums = sorted(se)[:10] print(nums[N - 1])