結果

問題 No.1058 素敵な数
ユーザー kbyskbys
提出日時 2020-06-02 01:29:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 48,836 KB
最終ジャッジ日時 2024-05-02 06:58:10
合計ジャッジ時間 7,979 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#1058
import numpy as np
import itertools
def create_prime_list(limit):
    x = limit**0.5
    primes = []
    #print('x={0}'.format(x))
    nums = [x for x in range(2, limit+1)]
    while nums[0]<=x:
        primes.append(nums[0])
        current_prime = nums[0]
        nums = [x for x in nums if x%current_prime != 0]
    primes.extend(nums)
    return primes

N = int(input())

ans = [1]

s = np.array(create_prime_list(10**5+5*10**4))
s = s[s>10**5][:10]
#print(s)

for i,j in itertools.combinations(s, 2):
    ans.append(i*j)
for i in s:
    ans.append(i**2)

ans.sort()
print(ans)

print(ans[N-1])
0