题解 | #兔子的序列#
兔子的序列
http://www.nowcoder.com/practice/55fc2ebad3fd444bbb1754ba1b259762
#include<stdio.h>
int main()
{
int n, arr[1000];
scanf("%d", &n);
for(int i=0; i<n; i++)
{
scanf("%d ", arr+i);
}
int max = 0;
for(int i=0; i<n; i++)
{
int flag = 0;
for(int j=1; j*j<=arr[i]; j++)
{
if(arr[i] == j*j)
{
flag = 1;
break;
}
}
if(flag == 0)
{
max = max > arr[i] ? max : arr[i];
}
}
printf("%d", max);
}