【链接】h在这里写链接
【题意】
在这里写题意
【题解】
让x没有出现,以及0..x-1都出现就可以了。
【错的次数】
0
【反思】
在这了写反思
【代码】
#include <bits/stdc++.h> using namespace std; const int N = 100; int a[N + 10], n, x; int main() { //freopen("F:\rush.txt", "r", stdin); ios::sync_with_stdio(0), cin.tie(0); cin >> n >> x; for (int i = 1; i <= n; i++) { int y; cin >> y; a[y]++; } int sum = 0; for (int i = x - 1; i >= 0; i--) { if (a[i] == 0) { sum += 1; } } if (a[x] > 0) sum += a[x]; cout << sum << endl; return 0; }