第四个测试点挂掉了
还有救吗
#include <bits/stdc++.h>
using namespace std;
int a(int n) {
if (n == 2) {
return 0;
}
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
return 1;
}
}
return 0;
}
int main() {
int n = 0;
cin >> n;
int s = 0;
int y = 0;
for (int i = 2;; i++) {
int m = a(i);
if (y >= n) {
break;
}
if (m == 0) {
s ++;
y += i;
if (y >= n) {
y = y - i;
s = s - 1;
break;
}else{
cout << i << endl;
}
}
}
cout << s;
return 0;
}