题解 | #兔子的序列# 二分
[NOIP2010]数字统计
https://ac.nowcoder.com/acm/contest/19859/A
#include<bits/stdc++.h>
#define io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int ll;
typedef pair<int,int> PII;
int n,q,ans;
bool judge_sqrt(int x)
{
int l=0;int r=x/2;
while(l < r)
{
int mid=l+((r-l+1)>>1);
if((long long)mid*mid <= x) //寻找ML 模板1
{
l=mid;
}
else
{
r=mid-1;
}
}
if(l * l == x)return false;
else
{
return true;
}
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>q;
if(judge_sqrt(q) && q > ans)
{
ans=q;
}
}
cout<<ans<<endl;
}