Submission #00059


ソースコード

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
#include <bits/stdc++.h>
#define endl "\n"
#define INF INT_MAX
using namespace std;
bool isPrime(long long x) {
for (int i = 2; i * i <= x; i++) {
if (x % i == 0) return false;
}
return true;
}
int get(int n,int m){
if(m == 0)return n;
int ans = 0,i = 1;
while(true){
i++;
if(isPrime(i))ans++;
if(ans == n){
int a = get(i,m-1);
return a;
}
}
}
int main(){
#define int long long
cin.tie(nullptr);ios::sync_with_stdio(false);
int n,m;
cin >>n>>m;
cout <<get(n,m)<<endl;
}

ステータス

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

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in-01.txt AC 15 ms 604 KB
1
in-02.txt AC 23 ms 688 KB
1
in-03.txt AC 233 ms 516 KB
1
in-04.txt AC 22 ms 476 KB
1
in-05.txt AC 25 ms 552 KB
1
in-06.txt AC 19 ms 504 KB
1
in-07.txt AC 19 ms 592 KB
1
in-08.txt AC 19 ms 680 KB
1
in-09.txt AC 21 ms 636 KB
1
in-10.txt AC 59 ms 588 KB
1