#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll i,j,k,l,m,n,test;
cin>>test;
for(k=1;k<=test;k++)
{
map<ll,ll>mp;
cin>>n;
for(i=0;i<n;i++)
{
cin>>m;
mp[m]++;
}
ll cnt=0;
map<ll,ll>::iterator it;
for(it=mp.begin();it!=mp.end();++it)
{
ll p=it->first;
ll q=it->second;
p++;
if(q%p==0)
{
cnt+=(((q/p)*(p)));
}
else
{
cnt+=((q/p)*(p)+p);
}
}
cout<<"Case "<<k<<": "<<cnt<<endl;
}
return 0;
}
using namespace std;
typedef long long ll;
int main()
{
ll i,j,k,l,m,n,test;
cin>>test;
for(k=1;k<=test;k++)
{
map<ll,ll>mp;
cin>>n;
for(i=0;i<n;i++)
{
cin>>m;
mp[m]++;
}
ll cnt=0;
map<ll,ll>::iterator it;
for(it=mp.begin();it!=mp.end();++it)
{
ll p=it->first;
ll q=it->second;
p++;
if(q%p==0)
{
cnt+=(((q/p)*(p)));
}
else
{
cnt+=((q/p)*(p)+p);
}
}
cout<<"Case "<<k<<": "<<cnt<<endl;
}
return 0;
}
No comments:
Post a Comment