注意审题。。。题目有一句话说的是存在即可
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <cmath>
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int n;
scanf("%d",&n);
int a[100005];
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(int i=n;i>=0;i--)
{
int count = 0;
for(int j=0;j<n;j++)
{
if(a[j]>i)
{
count ++;
}
}
if(count >= i)
{
printf("%d\n",i);//阴题。。 注意题目里的有 存在即可。。。
return 0;
}
}
//system("pause");
return 0;
}