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

问了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. 关于CORS

    前几天碰到CORS问题,只要在“Access-Control-Allow-Origin”响应头中添加对应域名即可. 今天做一个上传文件的demo,利用XMLHttpRequest向服务器发送post请 ...

  2. zedboard - 轻量级以太网控制器LWIP

    ipconfig/all route print  显示本机所有的网络 网关是什么 那么网关到底是什么呢?网关实质上是一个网络通向其他网络的IP地址.比如有网络A和网络B,网络A的IP地址范围为&qu ...

  3. AJAX项目中的一些总结

    最近在做AJAX数据处理交互,遇到一些问题,备份以免以后忘记 1.参数地址问题 确保参数地址的正确性 ; 阅读后台源码,参数和返回值要确定: 一般的大点公司应该有规范: 2.关于ajax事件触发请求多 ...

  4. 运行yum报错Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

    今天给Centos通过rpm -Uvh装了个epel的扩展后,执行yum就开始报错: Error: Cannot retrieve metalink for repository: epel. Ple ...

  5. Cassandra1.2文档学习解读计划——为自己鼓劲

    最近想深入研究一下Cassandra,而Cassandra没有中文文档,仅有的一些参考书都是0.7/0.6版本的.因此有个计划,一边学习文档(地址:http://www.datastax.com/do ...

  6. RichTextBox 自动滚动到最后

    RichTextBox.AppendText($"[{DateTime.Now.ToString("hh:mm:ss")}] {msg}\n"); RichTe ...

  7. myeclipse配置下tomcat debug启动很无比慢

    myeclipse配置下tomcat debug启动很无比慢,而run启动很快今天照常使用MyEclipse 6.5 Blue Edition进行开发,但是却遇到一个怪问题.在MyEclipse环境下 ...

  8. java排序集锦

    java实现排序的一些方法,来自:http://www.javaeye.com/topic/548520 package sort; import java.util.Random; /** * 排序 ...

  9. 【Nhibernate】入门 踩雷篇

    总结(喜欢写在前面,记性不好老忘记解决问题时的思路): 使用框架一般不会完整的看文档,直接上来就搞,踩雷是必须的,重要的是遇到雷的时候要快速变换思路,是不是姿势不对(文件位置不对) 提高解决问题的速度 ...

  10. 【nodejs】 npm 注意事项

    官网:https://www.npmjs.com/ 1.安装时要切换到nodejs根目录,  否则就会安装到安装时所在的目录 2.要有管理员权限(win),如需指定版本,如npm install ex ...