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. JVM命令参数指南

    1.调整最大堆内存 -Xmx 8192m 2.调整最小堆内存-Xmx 8192m3.设置虚拟机垃圾回收机制-XX:+UseG1GC4.收集垃圾日志信息-Xloggc:/D:gc.log5.OOM异常之 ...

  2. RabbitMQ安装后,BADARG问题

    最近RabbitMQ安装后始终不能运行,发现异常关键信息如下 =CRASH REPORT==== 10-Nov-2017::13:41:09 === crasher: initial call: ap ...

  3. windows phone控件

    常用控件: 包括: Button控件.CheckBox控件.HyperlinkButton控件.Iamege控件.ListBox控件.PasswordBox控件.ProgressBar控件.Radio ...

  4. javascript中执行环境和作用域(js高程)

    执行环境(execution context,为简单起见,有时也成为“环境”)是javascript中最为重要的一个概念.执行环境定义了变量或函数有权访问的其他数据,决定了它们各自的行为.每个执行环境 ...

  5. Multipart/form-data POST文件上传

    简单的HTTP POST 大家通过HTTP向服务器发送POST请求提交数据,都是通过form表单提交的,代码如下: <form method="post"action=&qu ...

  6. sqlserver查询分析器在本地服务器查看其它SqlServer服务器内容

    exec sp_addlinkedserver 服务器自命名,'',sqloledb,要查询服务器的IP地址 exec sp_addlinkedsrvlogin 服务器自命名,false,null,账 ...

  7. [Intermediate Algorithm] - Steamroller

    题目 对嵌套的数组进行扁平化处理.你必须考虑到不同层级的嵌套. 提示 Array.isArray() 测试用例 steamroller([[["a"]], [["b&qu ...

  8. 作业07之《MVC模式》

    MVC(Model View Controller)模型-视图-控制器 MVC与模板概念的理解 MVC本来是存在于Desktop程序中的,M是指数据模型,V是指用户界面,C则是控制器.使用MVC的目的 ...

  9. jsTree checkbox plugin使用笔记

    引入css文件 <link rel="stylesheet" type="text/css" href="js/assets/global/pl ...

  10. 【转载】servlet三大作用域:request,session,application

    javaweb开发中Servlet三大域对象的应用(request.session.application(ServletContext)). 1. requestrequest是表示一个请求,只要发 ...