题解:P12696 [KOI 2022 Round 2] 原位卡片
_FengYuan_ · · 题解
PART 1 思路
本题只需要查找卡片中有无
PART 2 样例解释
PART 3 Code
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
int n;
cin>>n;
int a[n],t=1; //t用来储存符合条件的卡牌张数
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]==t) t++;//查找是否有1,2,3… 的序列
}
cout<<n-t+1;//输出少了几个
return 0;
}