sdnuoj1536(水题)

1536.How many users on SDNU OJ
题目见下图
可以用map

#include <cstdio>
#include <iostream>
#include <map>
#include <cstring>
using namespace std;
int main()
{
   
    int t,n,i,j,m;
    string s;
    map<string,int>mp;
    map<string,int>::iterator b;
    scanf("%d",&t);
    for(i=1;i<=t;i++)
    {
   
        scanf("%d",&n);
        m=n;
        getchar();
        for(j=0;j<n;j++)
        {
   
            getline(cin,s);
            mp[s]++;
        }
        for(b=mp.begin();b!=mp.end();b++)
        {
   
            if(b->second>1)
                m=m-b->second+1;
        }
        cout<<"Case #"<<i<<": "<<m<<'\n';
        mp.clear();
    }
    return 0;
}

全部评论

相关推荐

mjasjon:这种trash中厂 简历过筛概率比大厂还低(除阿里系)
投递哔哩哔哩等公司6个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务