Untitled
Anonymous
c_cpp
10/17/2026 4:10 PM
944 B
5
Indexable
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define PI 3.14
using namespace std;
void testCase()
{
int n;
cin>>n;
int arr[n];
int freq[101]={};
for(int i=0;i<n;i++){
cin>>arr[i];
freq[arr[i]]++;
}
int counter=0;
for(int i=0;i<101;i++){
if(freq[i]>i){
counter+=(freq[i]-i);
}
else if(freq[i]<i){
counter+=freq[i];
}
}
cout<<counter<<endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t=1;
cin>>t;
while(t--){
testCase();
}
return 0;
}
Editor is loading...
Leave a Comment