用户输出
3
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#89079 | #105. zxh的继承顺位 | Accepted | 100 | 858 ms | 368 K | C++ / 479 B | 建业弘天韵 | 2023-05-26 21:33:36 |
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n, count = 1, flag, num = 3;
cin >> n;
if (n == 1) {
cout << 2;
}
while (count != n) {
flag = 1;
for (int j = 3; j <= sqrt(num); j = j + 2) {
if (num % j == 0) {
flag--;
break;
}
}
num += 2;
if (flag) {
count++;
}
}
cout << num - 2;
}