桶排序80分求助
查看原帖
桶排序80分求助
1271475
jiaoxueyanghaoyu321楼主2024/7/18 14:41

醉了,到底哪里错了

#include <iostream>

using namespace std;

const int N = 1e8 + 5;
int a[N];

int main()
{
	int x, y, z;
	cin >> x >> y >> z;
	for (int i = 2; i < 10000000; i ++) {
		if (x % i == 0 and y % i == 0 and z % i == 0) {
			a [i] = 1;
		}
	}
	for (int i = 10000000; i >= 0; i --) {
		if (a[i] == 1) {
			cout << i;
			return 0;
		}
	}
	return 0;
}
2024/7/18 14:41
加载中...