CodeFoeces-862A

题目

原题链接:A. Mahmoud and Ehab and the MEX

题意

给出有n个数字的序列,问需要最少几步能使该序列的mex=x。
参考了其他作者的思路。mex即0~x-1全部出现。

代码

#include
using namespace std;
int main() {
    int n,x,s[110],t[101]={0};
    cin>>n>>x;
    for(int i=0;i>s[i];
        t[s[i]]++;
    }
    int tmp=0,flag=0;
    for(int i=0;i<=x;i++){
        for(int j=0;j

你可能感兴趣的:(CodeFoeces-862A)