首页 > 其他 > 详细

hdu 1251 统计难题 (map水过)

时间:2014-08-15 22:34:19      阅读:426      评论:0      收藏:0      [点我收藏+]
# include <stdio.h>
# include <algorithm>
# include <string.h>
# include <map>
# include <iostream>
using namespace std;
int main()
{
    char a;
    string  x;
    map<string,int>q;
    while(true)
    {
        scanf("%c",&a);
        if(a=='\n')
        {
            scanf("%c",&a);
            x="";//一个结束x初始化
        }
        if(a=='\n')//连续两个\n结束了母串的输入
            break;
        x+=a;
        q[x]+=1;
    }
    while(cin>>x)
        printf("%d\n",q[x]);
    return 0;
}

hdu 1251 统计难题 (map水过),布布扣,bubuko.com

hdu 1251 统计难题 (map水过)

原文:http://blog.csdn.net/lp_opai/article/details/38591599

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!