作者:疯疯癫癫丶是一种掩饰_954 | 来源:互联网 | 2023-10-12 18:20
[题目链接]https:www.luogu.orgproblemnewshowP4549cppluogujudgerenableo2includeincludeusingnames
[题目链接] https://www.luogu.org/problemnew/show/P4549
// luogu-judger-enable-o2
#include
#include
using namespace std;
typedef long long LL;
const int INF=1e9+7;
inline LL read(){
register LL x=0,f=1;register char c=getchar();
while(c<48||c>57){if(c==‘-‘)f=-1;c=getchar();}
while(c>=48&&c<=57)x=(x<<3)+(x<<1)+(c&15),c=getchar();
return f*x;
}
int n,ans,x;
inline int gcd(int a,int b){return (!b)?a:gcd(b,a%b);}
int main(){
n=read();
ans=0;
for(int i=1;i<=n;i++){
int x=abs(read());
ans=gcd(ans,x);
}
printf("%d\n",ans);
}
P4549 【模板】裴蜀定理