60分,求救大佬
查看原帖
60分,求救大佬
1025321
midsummer_zyl楼主2023/7/6 18:02
#include <bits/stdc++.h>
using namespace std;
int zs(int x) {
	if(x <= 1)
		return 0;
	if(x == 2)
		return 1;
	for (int i = 2; i < x; i++)
		if(x % i == 0) 
			return 0;
	return 1;
}
int main() {
    int n, flag = 0;
    scanf("%d", &n);
    for (int i = 2; ; i++) {
    	if(zs(i) == 1)
    		flag++;
    	if(flag == n) {
    		printf("%d", i);
    		return 0;
		}
	}
    return 0;
}
2023/7/6 18:02
加载中...