文章
60
粉丝
361
获赞
43
访问
528.2k
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
int main()
{
int n,m;
while(cin>>n)
{
vector<int>a;
for(int i=0;i<n;i++)
{
cin>>m;
a.push_back (m);
}
sort(a.begin (),a.end());
cout<<a[0]<<" "<<a[a.size()-1]<<" "<<gcd(a[0],a[a.size()-1])<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发