[关闭]
@inkysakura 2017-09-25T15:50:13.000000Z 字数 362 阅读 1119

lightoj1148

CODE

#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
int ncase;
int main()
{
        int t;
        cin >> t;
        while(t--)
        {
                int n;
                map<int,int>m;
                cin >> n;
                for(int i=0;i<n;i++)
                {
                        int tp;
                        cin >> tp;
                        tp++;
                        m[tp]++;
                }
                map<int,int>::iterator it;
                int ans=0;
                for(it=m.begin();it!=m.end();it++)
                {
                        ans+=((it->second+it->first-1)/it->first)*it->first;
                }
                printf("Case %d: %d\n",++ncase,ans);
        }
        return 0;
}
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注