题解
2026-10-31 21:37:55
发布于:北京
0阅读
0回复
0点赞
题目传送门
一个水题
代码:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, q;
cin >> n >> q;
int * a = new int [n + 5];
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= q; i++)
{
int tmp = a[1] + i;
for (int j = 2; j <= n; j++)
{ tmp = __gcd(tmp, a[j]+i);
if (tmp == 1)
break;
}
cout << tmp << endl;
}
return 0;
}
这里空空如也








有帮助,赞一个