文章
5
粉丝
138
获赞
6
访问
26.9k
#include <iostream>
using namespace std;
const int INF = 0x7ffffff;
int gcd(int a, int b) {
if( b==0 ) return a;
return gcd(b, a%b);
}
int main() {
int n, num, minn = INF, maxn = -1;
cin >> n;
while(cin >> num) {
if(num > maxn) maxn = num;
if(num < minn) minn = num;
}
cout << minn << " " << maxn << " " << gcd(minn, maxn) << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发