← Back to List

16435번: 스네이크버드 ↗

Solutions

C++14
234 B | 234 chars
#include <bits/stdc++.h>
using namespace std;
int N,L;
int ar[1100];
int main()
{
    cin>>N>>L;
    for(int x=0; x<N; x++) cin>>ar[x];
    sort(ar,ar+N);
    for(int x=0; x<N; x++)
    {
        if(ar[x]<=L) L++;
    }
    cout<<L;
}