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. B - Sleuth

    Problem description Vasya plays the sleuth with his friends. The rules of the game are as follows: t ...

  2. 5.23@Comfiguration的解释

    @Configuration:代表这个类是一个配置类. @ComponentScan:用来扫描指定包下面的注解类. @Import:用来导入其他的@Configuration配置类. @ImportR ...

  3. C# 多线程系列(四)

    Parallel类 Parallel类定义了for.foreach和invoke的静态方法.Parallel类使用多个任务,因此使用多个线程来完成这个作业. Parallel.For Parallel ...

  4. iOS多线程——GCD篇

    什么是GCD GCD是苹果对多线程编程做的一套新的抽象基于C语言层的API,结合Block简化了多线程的操作,使得我们对线程操作能够更加的安全高效. 在GCD出现之前Cocoa框架提供了NSObjec ...

  5. 查看Oracle数据库表空间大小,是否需要增加表空间的数据文件

    在数据库管理中,磁盘空间不足是DBA都会遇到的问题,问题比较常见. --1查看表空间已经使用的百分比 Sql代码 select a.tablespace_name,a.bytes/1024/1024 ...

  6. PHP 数组基础知识

    php 数组基础知识function abc($a,$b,$c = 0){ echo $a,$b,$c;}abc(1,3); //调用方法 ////可变参数function def(){ $arr = ...

  7. AI:IPPR的数学表示-CNN基本结构分析( Conv层、Pooling层、FCN层/softmax层)

    类似于SVM,CNN为代表的DNN方法的边缘参数随着多类和高精度的要求必然增长.比如向量机方法,使用可以映射到无穷维的高斯核,即使进行两类分类,在大数据集上得到高精度,即保持准确率和高精度的双指标,支 ...

  8. End to End Sequence Labeling via Bi-directional LSTM CNNs CRF

    来看看今日头条首席科学家的论文: End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF 使用LSTM方法进行序列标注,完成大规模标 ...

  9. C/C++关键字

    1. static关键字 作用 在函数体内静态变量具有记忆功能.在函数体内定义的静态变量离开时不会被清除,在下次函数调用的时候其值保持不变. 限制变量或函数的使用范围.static修饰的全局变量或者函 ...

  10. java 循环document 通用替换某个字符串或特殊字符

    document 生成xml时 报错 XML-20100: (Fatal Error) Expected ';'.  查了半天发现是 特殊字符 & 不能直接转出,需要进行转换,因为是通用方法很 ...