以前做过的用的字典树,可是貌似现在再用超内存。。。。求解释。。。

问了LYN用的map函数做的,又去小小的学了map函数。。。。

http://wenku.baidu.com/view/0b08cece05087632311212ba.html感觉这个写的挺详细的

http://wenku.baidu.com/view/d140cfcca1c7aa00b52acb46.html这个的话挺有意思,帮助理解

题目描述

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

这个是代码

 #include<cstdio>
#include<cstring>
#include<cstdlib>
#include<map>
#include<iostream>
#include<algorithm>
using namespace std ;
int main()
{
int m ;
while(scanf("%d",&m)&&(m != ))
{
int n ;
cin>>n ;
map<string,int>mp ;
string sh ;
for(int i = ; i <= m ; i++)
{
cin>>sh ;
transform(sh.begin(),sh.end(),sh.begin(),::tolower) ;
mp[sh] = ;
}
for(int j = ; j <= n ; j++)
{
cin>>sh ;
transform(sh.begin(),sh.end(),sh.begin(),::tolower) ;
if(mp[sh])
{
m--;
mp[sh] = ;
}
}
cout<<m<<endl ;
}
return ;
}

SDUT1500 Message Flood的更多相关文章

  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. Message Flood(map)

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

  6. oj1500(Message Flood)字典树

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

  7. SDUT 1500-Message Flood(set)

    Message Flood Time Limit: 1500ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描写叙述 Well, how do you feel abo ...

  8. Eclipse 4.2 failed to start after TEE is installed

    ---------------  VM Arguments---------------  jvm_args: -Dosgi.requiredJavaVersion=1.6 -Dhelp.lucene ...

  9. 浅谈原始套接字 SOCK_RAW 的内幕及其应用(port scan, packet sniffer, syn flood, icmp flood)

    一.SOCK_RAW 内幕 首先在讲SOCK_RAW 之前,先来看创建socket 的函数: int socket(int domain, int type, int protocol); domai ...

随机推荐

  1. 《postfix邮件服务下mailq、postmap、postqueue 、 postsuper等用法》

    1.Mailq 功能说明:显示待寄邮件的清单. 语 法:mailq [-q] 补充说明:mailq可列出待寄邮件的清单,包括邮件ID,邮件大小,邮件保存时间,寄信人,收信人,以及邮件无法寄出的原因,提 ...

  2. CSS3属性box-shadow使用教程

    CSS3的box-shadow属性可以让我们轻松实现图层阴影效果.我们来实战详解一下这个属性. 1. box-shadow属性的浏览器兼容性先来看一个这个属性的浏览器兼容性: Opera: 不知道是从 ...

  3. winform:无法引用其他类库,dll,using等个人看法【图】

    在项目类库中已经引用了相关了类库,生成解决方案也没问题,但是到了后置代码,通过using引用其他类库的时候,再生成解决方案或者生成单个类库,就会报“未能找到类型或命名空间“xxx"(是否缺少 ...

  4. DataSnap如何监控Tcp/IP客户端的连接情况

    一个实例,如果客户端是TCP/IP是短连接的情况就没有必要了. 一.GlobVar.pas单元,定义应用系统全局数据类型及变量: unit GlobVar; interface uses System ...

  5. 每日一“酷”之Cookie

    Cookie---Http Cookie 作用:Cookie模块定义一些类来解析和创建HTTP cookie首部 Cookie模块为大多数符合RFC 2109的cookie实现一个解析器.这个实现没有 ...

  6. #ifdef预编译相关用法

    #ifdef预编译相关用法主要有:(1)#ifdef XXX executing the corresponding xxx code #endif(2)#ifdef XXX executing th ...

  7. 【nodejs】 文件系统(fs) 之读写文件

    //写入文件 var data = "hello world"; fs.writeFile('c:\\a.txt', data, 'ascii', function(err) { ...

  8. php中函数内使用static修饰变量

    首先理解静态变量的区别,声明一个函数test() function num(){ $a = 0; echo $a; $a++; } num();num();num(); //输出000 functio ...

  9. 折腾了好久的macos+apache+php+phpmyadmin 终于成功了!

    由于最近需要布置mantis用来进行bug追踪,在此记录其过程. 由于PHP apache环境在Mac OS上是自带的,所以不需要另处下安装包,只需要简单配置一下即可. 首先打开终端输入命令: sud ...

  10. 关于const

    1.顶层const和底层const const修饰的对象本身是常量,则为顶层const,否则为底层const 如: const int a=10;        //a是int常量,顶层const i ...