CodeFoeces-682B

题目

原题链接:B. Alyona and Mex

题意

给出一个长度为n的序列,每个可以进行减1操作,问在形成非递减序列后,未在序列出现的最小的数。
题意没读懂,看了其他作者的说明。用一个变量记录最小值即可。

代码

#include
using namespace std;
int main() {
    int n,s[100000],ans=1;
    cin>>n;
    for(int i=0; i>s[i];
    }
    sort(s,s+n);
    for(int i=0; i=ans) {
            ans++;
        }
    }
    cout<

你可能感兴趣的:(CodeFoeces-682B)