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;
}

全部评论

相关推荐

半解316:内容充实,细节需要修改一下。 1,整体压缩为一页。所有内容顶格。 2,项目描述删除,直接写个人工作量 修改完之后还需要建议,可以私聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务