mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1144_***117.cpp
This commit is contained in:
parent
2fc9b9bc2a
commit
1ad75c6184
41
QUSTOJ/1144_***117.cpp
Normal file
41
QUSTOJ/1144_***117.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include <cstdio>
|
||||
#include <cmath>
|
||||
int prime[20010],f[20000];
|
||||
void prime_2()
|
||||
{
|
||||
int n=20000,t=0;
|
||||
for (int i=2;i<=n;i++)
|
||||
{
|
||||
if (!f[i])
|
||||
{
|
||||
prime[t++]=i;
|
||||
int j=2*i;
|
||||
while (j<=n)
|
||||
{
|
||||
f[j]=1;
|
||||
j+=i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int main ()
|
||||
{
|
||||
int n,x;
|
||||
prime_2();
|
||||
scanf("%d",&n);
|
||||
int max=-1,m=0;
|
||||
for (int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
if (n==1) m=x;
|
||||
else
|
||||
for (int j=0;prime[j]<=x;j++)
|
||||
if (x%prime[j]==0&&j>max)
|
||||
{
|
||||
max=j;
|
||||
m=x;
|
||||
}
|
||||
}
|
||||
printf("%d",m);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user