请求加强数据
查看原帖
请求加强数据
807041
hjyowl楼主2024/8/15 08:37

本题数据过水,对于这个代码:

#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
int a[N];
int main(){
	int n;
	cin >> n;
	for (int i = 1; i <= n; i ++ ){
		cin >> a[i];
	}
	int t = 0;
	for (int i = 1; i <= n; i ++ ){
		for (int j = i + 1; j <= n; j ++ ){
			t = __gcd(t,abs(a[i] - a[j]));
		}
	}
	//2 1e9 1e5
	for (int i = 2; i <= t; i ++ ){
		if (t % i == 0){
			cout << i << " ";
		}
	}
	return 0;
}

对于hack数据:

2
1000000000 100000

加上了clock,运行了 13441344 毫秒。

实测会TLE,但是能AC,请求添加hack数据。

2024/8/15 08:37
加载中...