1060

// PATn.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include
#include
#include
using namespace std;


int main()
{
    unsigned n;
    cin >> n;

    vector data;
    for (unsigned i = 0; i < n; ++i)
    {
        unsigned tmp;
        cin >> tmp;
        data.push_back(tmp);
    }
    sort(data.begin(), data.end());

    int e_d = n;    //保证n大于0!
    int e_e = e_d;
    for (; e_d >= 0; --e_d,e_e=e_d)     //爱丁系数可以为0!0天骑车超过0英里!(怪怪的!)
    {
        int max_no_fit = n - e_d;
        int no_fit = 0;
        for (auto &r : data)
        {
            if (r <= e_e)
                no_fit += 1;

            if (no_fit > max_no_fit)
                break;
        }
        if (no_fit <= max_no_fit)
        {
            cout << e_d;
            break;
        }
    }
    
    system("pause");
    return 0;
}

你可能感兴趣的:(1060)