Submission #00057


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<bits/stdc++.h>
using namespace std;
int n,m;
vector<int>sosu(0);
int sb(int n){
return sosu[n-1];
}
int main(){
int n,m;cin>>n>>m;
int th=30*30*30*30*30;
vector<bool>a(th+1,0);
for(int i=3;i*i<th;i++){
if(a[i]==false){
for(int j=i+i;j+i<=th;j+=i){
a[j]=true;
}
}
}
sosu.push_back(2);
for(int i=3;i<=30*30*30*30*30;i+=2){
if(a[i]==false){
sosu.push_back(i);
}
}
if(m==1)cout<<sb(n)<<"\n";
if(m==2)cout<<sb(sb(n))<<"\n";
if(m==3)cout<<sb(sb(sb(n)))<<"\n";
if(m==4)cout<<sb(sb(sb(sb(n))))<<"\n";
if(m==5)cout<<sb(sb(sb(sb(sb(n)))))<<"\n";
}

ステータス

項目 データ
問題 0014 - 素数番目の素数
ユーザー名 ei2331
投稿日時 2023-11-13 12:14:54
言語 C++17
状態 Accepted
得点 50
ソースコード長 645 Byte
最大実行時間 125 ms
最大メモリ使用量 13896 KB

セット

セット 得点 Cases
1 ALL 50 / 50 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in-01.txt AC 122 ms 12488 KB
1
in-02.txt AC 116 ms 12928 KB
1
in-03.txt AC 125 ms 13000 KB
1
in-04.txt AC 115 ms 13156 KB
1
in-05.txt AC 115 ms 13896 KB
1
in-06.txt AC 110 ms 13000 KB
1
in-07.txt AC 113 ms 12288 KB
1
in-08.txt AC 123 ms 12244 KB
1
in-09.txt AC 119 ms 13876 KB
1
in-10.txt AC 119 ms 11876 KB
1