#1RE求助
查看原帖
#1RE求助
1433965
ofthemoon楼主2025/1/24 11:22
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+5;
int n;
int a[maxn],sum[maxn];
int ans;
int main()
{
	cin>>n;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int i=2; i<=n; i++)
		sum[i-1]=a[i]-a[i-1];
	int maxgcd=sum[1];
	for(int i=2; i<n; i++)
		maxgcd=__gcd(maxgcd,sum[i]);
	cout<<(a[n]-1)/maxgcd+1<<' '<<maxgcd;
	return 0;
}
2025/1/24 11:22
加载中...