結果

問題 No.1058 素敵な数
ユーザー lloyzlloyz
提出日時 2022-03-02 00:14:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 1,295 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 84,616 KB
最終ジャッジ日時 2023-09-22 15:57:07
合計ジャッジ時間 3,244 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,932 KB
testcase_01 AC 119 ms
84,080 KB
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 #

n = int(input())

if n == 1:
    print(1)
    exit()

n -= 1
IsPrime = [True for _ in range(10**6 + 1)]
IsPrime[0] = IsPrime[1] = False
for i in range(2, 10**6 + 1):
    if IsPrime[i]:
        for j in range(i + i, 10**6 + 1, i):
            IsPrime[j] = False

for i in range(10**5 + 1, 10**6 + 1):
    if IsPrime[i]:
        n -= 1
        if n == 0:
            print(i * i)
            break
0