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. Winform 异步调用

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  2. SqlMap常用参数(一)

    sqlmap可谓是利用sql注入的神器了,sqlmap的参数很多,接下介绍几种常见的参数. 一.注入access数据库常用的参数 sqlmap.py -u "url"  //判断参 ...

  3. 常见文件MIME类型

    常见文件MIME类型.asx,video/x-ms-asf .xml,text/xml .tsv,text/tab-separated-values .ra,audio/x-pn-realaudio ...

  4. jquery中的left和top

    left 和 top /*1. 获取元素基于定位容器的位置*/ /*返回的是对象 属性 left top */ var position = $('.inner').position(); conso ...

  5. var _this = this 是干什么的

    因为JS可以多层嵌套代码可能下面还可以再嵌一个方法引用this就会变成子方法控制的对象如果需要上级的对象在没有参数的情况下前面前提做了一个临时变量_this可以保存上级对象子方法中就可以用_this来 ...

  6. for 循环 乘法口诀表

    用for循环写乘法口诀表: for(var i = 1; i <= 9; i++) { var c=''; for(var x = 1; x <= i; x++) {    c=c+x+' ...

  7. 搭建Hive所遇到的坑

    ##一.基本功能: 1.启动hive时报错 java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Metho ...

  8. 11.03 在外链接中用OR逻辑

    select e.ename,d.deptno,d.dname,d.locfrom dept d left join emp e on(d.deptno = e.deptnoand (e.deptno ...

  9. Tomcat 服务器中jsp页面乱码

    <Connector port="80" protocol="HTTP/1.1"               connectionTimeout=&quo ...

  10. iphone 事件冒泡规则

    今天碰到的一个比较烦人的问题是,在body上添加事件处理函数,发现在iphone上怎么也没办法触发事件,找了半天,发现iPhone处理冒泡事件的规则: 1.点击某个元素: 2.如果这个元素上没有处理该 ...