无法运行求助
查看原帖
无法运行求助
1078007
yuyuelong楼主2023/11/1 21:07
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
bool a[100000005] = { 1,1 };
int s[100000005];
long long x;
int main() {
	int y = 0;
	cin >> x;
	for (int i = 2; i <= x; i++) {
		if (a[i] == 0) {
			s[y++] = i;
		}
		for (int j = 1; j <= x; j++) {
			if (i * s[j] > x) {
				break;
			}
			a[i * s[j]] = 1;
			if (i % s[j] == 0) {
				break;
			}
		}
	}
	cout << y << endl;
	return 0;
}

请大佬帮我看看为什么我的代码编译成了但无法输出,到这边更是直接编译失败。。。

2023/11/1 21:07
加载中...