HUST Online Judge WebBoard
Problem 1134 >> 答案错误
201803010212 @ 2019-05-24 11:19:41
[ Quote ] [ Edit ] [ Delete ] 1#
#include<stdio.h>
#include<math.h>
int prime(int x)
{
int i;
if(x<2)
return 0;
for(i=2;i<=sqrt(x);i++)
{
if(x%i==0)
return 0;
}
if(i>=sqrt(x))
return 1;
else
return 0;
}
int primer(int x)
{
int i;
for(i=2;i<x;i++)
{
if(x%i==0&&prime(i))
{
if(prime(x/i))
return (x/i);
else
return (primer(x/i));
}
}
}
int main()
{
int m,i,j,n,t,max=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m);
j=primer(m);
if(j>=max)
{
max=j;
t=m;
}
}
printf("%d\n",t);
return 0;
}