結果

問題 No.1058 素敵な数
ユーザー lllllll88938494lllllll88938494
提出日時 2022-08-26 11:42:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 73,600 KB
最終ジャッジ日時 2024-04-21 14:56:19
合計ジャッジ時間 1,409 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,712 KB
testcase_01 AC 82 ms
72,960 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 #

x=int(input())
x-=1

if x == 0:
    print(1)
    exit()

def  c(n):
    sosu=[True]*(n+1)
    sosu[0],sosu[1] = False,False
    cnt=0
    for i in range(4,n+1,2):
        sosu[i] = False
    
    for i in range(3,int(n**0.5)+1,2):
        if sosu[i] == False:
            continue
        for j in range(i,n//i+1,2):
            sosu[j*i]=False
    return [p for p in range(n + 1) if sosu[p]==True]

n=10**6
t=c(n)
cnt=0
for i in range(len(t)):
    if t[i] > 10**5:
        cnt+=1
        
    if cnt == x:
        print(t[i]**2)
        break
        
        
0