結果
問題 | No.1058 素敵な数 |
ユーザー | lllllll88938494 |
提出日時 | 2022-08-26 11:53:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 72 ms / 2,000 ms |
コード長 | 706 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 82,652 KB |
実行使用メモリ | 74,348 KB |
最終ジャッジ日時 | 2024-04-21 15:09:46 |
合計ジャッジ時間 | 1,502 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
53,036 KB |
testcase_01 | AC | 68 ms
73,504 KB |
testcase_02 | AC | 65 ms
74,000 KB |
testcase_03 | AC | 66 ms
73,884 KB |
testcase_04 | AC | 70 ms
73,832 KB |
testcase_05 | AC | 70 ms
73,172 KB |
testcase_06 | AC | 72 ms
73,568 KB |
testcase_07 | AC | 66 ms
74,316 KB |
testcase_08 | AC | 69 ms
73,704 KB |
testcase_09 | AC | 67 ms
74,348 KB |
ソースコード
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) p=[] cnt=0 for i in range(len(t)): if t[i] > 10**5: p.append(t[i]) cnt+=1 if cnt == 10: break ans=[] for i in range(len(p)-1): for j in range(i,len(p)): ans.append(p[i]*p[j]) ans.sort() print(ans[x-1])