Message Flood

Time Limit: 1500ms   Memory limit: 65536K  有疑问?点这里^_^

题目描写叙述

Well, how do you feel about mobile phone? Your answer would probably be something like that "It's so convenient and benefits people a lot". However, If you ask Merlin this question on the New Year's Eve, he will definitely answer "What
a trouble! I have to keep my fingers moving on the phone the whole night, because I have so many greeting message to send!" Yes, Merlin has such a long name list of his friends, and he would like to send a greeting message to each of them. What's worse, Merlin
has another long name list of senders that have sent message to him, and he doesn't want to send another message to bother them Merlin is so polite that he always replies each message he receives immediately). So, before he begins to send message, he needs
to figure to how many friends are left to be sent. Please write a program to help him. Here is something that you should note. First, Merlin's friend list is not ordered, and each name is alphabetic strings and case insensitive. These names are guaranteed
to be not duplicated. Second, some senders may send more than one message to Merlin, therefore the sender list may be duplicated. Third, Merlin is known by so many people, that's why some message senders are even not included in his friend list.

输入

There are multiple test cases. In each case, at the first line there are two numbers n and m (1<=n,m<=20000), which is the number of friends and the number of messages he has received. And then there are n lines of alphabetic strings(the
length of each will be less than 10), indicating the names of Merlin's friends, one per line. After that there are m lines of alphabetic strings, which are the names of message senders. The input is terminated by n=0.

输出

For each case, print one integer in one line which indicates the number of left friends he must send.

演示样例输入

5 3
Inkfish
Henry
Carp
Max
Jericho
Carp
Max
Carp
0

演示样例输出

3

来源

第9届中山大学程序设计竞赛预选赛
 
是一道字典树的题。额 眼下还不会敲字典树 先用set搞搞
翻译一下:输入一个邮件好友列表(无反复名称) 再输入一个邮件发送列表(可能有反复),且这两个列表里的好友名字都不区分大写和小写(坑) 求未发送邮件好友的数目
 
#include <iostream>
#include <algorithm>
#include <string.h>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <string>
#include <set>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
int n,m;
string x;
while(cin>>n&&n)
{
cin>>m;
set <string> s;
while(n--)
{
cin>>x;
for(int i=0;i!=x.size();i++)
x[i]=tolower(x[i]);
s.insert(x);
}
while(m--)
{
cin>>x;
for(int i=0;i!=x.size();i++)
x[i]=tolower(x[i]);
if(s.count(x))
s.erase(x);
}
cout<<s.size()<<endl;
}
return 0;
}

SDUT 1500-Message Flood(set)的更多相关文章

  1. Message Flood

    Message Flood Time Limit: 1500MS Memory limit: 65536K 题目描述 Well, how do you feel about mobile phone? ...

  2. Sicily 1194. Message Flood

    题目地址:1194. Message Flood 思路: 不区分大小写,先全部转化为小写,用stl提供的函数做会很方便. 具体代码如下: #include <iostream> #incl ...

  3. STL 之map解决 Message Flood(原字典树问题)

                                                                                      Message Flood Time ...

  4. sdut Message Flood(c++ map)

    用字典树没过,学习了一下map; 参考博客:http://blog.csdn.net/zhengnanlee/article/details/8962432 AC代码 #include<iost ...

  5. SDUT1500 Message Flood

    以前做过的用的字典树,可是貌似现在再用超内存....求解释... 问了LYN用的map函数做的,又去小小的学了map函数.... http://wenku.baidu.com/view/0b08cec ...

  6. Message Flood(map)

    http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=203#problem/D 以前用字典树做过 #include <strin ...

  7. oj1500(Message Flood)字典树

    大意:输入几个字符串,然后再输入几个字符串,看第一次输入的字符串有多少没有在后面的字符串中出现(后输入的字符串不一定出现在之前的字符串中) #include <stdio.h> #incl ...

  8. Checkstyle-Configuration

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module PUBLIC "-/ ...

  9. 富文本插件tinymce初始化配置参数说明

    { language: _this.language, // 显示语种 selector: #${_this.tinymceId}, // 容器的id height: _this.height, // ...

随机推荐

  1. Spring boot (12) tomcat jdbc连接池

    默认连接池 tomcat jdbc是从tomcat7开始推出的一个连接池,相比老的dbcp连接池要优秀很多,spring boot将tomcat jdbc作为默认的连接池,只要在pom.xml中引入了 ...

  2. 理解list和vector的区别

    原文:http://genwoxuevc.blog.51cto.com/1852984/503337 vector和数组类似,它拥有一段连续的内存空间,并且起始地址不变,因此它能非常好的支持随机存取( ...

  3. Ionic3 环境搭建以及基础配置实现(更新中)

    GitHub:https://github.com/Teloi 环境配置输入以下命令安装 Ionic (如果刚才设置了淘宝镜像源,可以使用 cnpm 代替 npm):npm install -g io ...

  4. selenium菜单操作

    连接到前端这个菜单下面的HTML/CSS子菜单 driver.get("https://www.imooc.com"); WebElement login = driver.fin ...

  5. Boost-QT兼容问题:#define FUSION_HASH #

    使用原始的MSVC10+QT48很长时间,需要把PCL升级到新的版本,不再使用自行编译的PCL1.7.2版本. 在使用MSVC2012的时候,使用MSVC12-的PCL1.8.0版本,出现了一个不大不 ...

  6. Haar、pico、npd、dlib等多种人脸检测特征及算法结果比较

    原文:opencv.pico.npd.dlib.face++等多种人脸检测算法结果比较 NDP检测结果: 结果分析: Pico(Pixel Intensity Comparison-based Obj ...

  7. SiftGPU:编译SiftGPU出现问题-无法解析的外部符号 glutInit

    OpenCV出现了ORB特征和SURF的GPU版本, 参考:opencv上gpu版surf特征点与orb特征点提取及匹配实例至于使用什么并行API暂时没有探究. 但没有发现OpenCV-SIFT的GP ...

  8. 解决Cannot change version of project facet Dynamic Web M 3.0

    解决Cannot change version of project facet Dynamic Web M 3.0 dynamic web module 版本之间的区别: Servlet 3.0 D ...

  9. .NET 解决方案 核心库整理

    一系列令人敬畏的.NET核心库,工具,框架和软件: https://www.cnblogs.com/weifeng123/p/11039345.html 企业级解决方案收录:  https://www ...

  10. java操作Excel的poi 创建一个sheet页

    package com.java.poi; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.us ...