#include<iostream>
using namespace std;
int main()
{
int a[100],n,i,j,x,y,maxx=0,mx,my;
cout<<"n="; cin>>n;
for(i=1;i<=n;i++) cin>>a[i];
for(i=1;i<=n;i++)
for(j=i+1;j<=n;j++)
{
x=a[i]; y=a[j];
while(x!=y)
if(x>y) x=x-y;
else y=y-x;
if(x>maxx)
{
maxx=x;
mx=a[i];
my=a[j];
}
}
cout<<mx<<" "<<my;
return 0;
}
|