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

问了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. CString使用

    1. 空间分配,如果不是它自己的空间分配方式,需要用函数来手动分配空间,否则大家指向同一块地址,取得内容一样 例子,读取文件到CString ,没有给CString 对象分配空间,而且不是他定义的开拓 ...

  2. MySQL触发器 Update触发Insert失败

    今天工作需要,想要实现将仅对状态更新的表进行历史记录显示,于是考虑在原表中建立触发器,将更新的内容同时写入另一张表 于是进行测试 --建立测试表CREATE TABLE `triggletest_tr ...

  3. 清空系统日志shell scripts——自学笔记

    这是一个清空系统日志的脚本: vim logmess_clean.sh #bin/bash        //该脚本所使用的shell解释器 cd /var/log/  //切换到存放日志目录 ech ...

  4. linux中的文件属性

    l 是链接d 是目录c 是字符设备文件b 是块设备- 是文件

  5. SQL server数据库内置账户SA登录设置

    SQL server数据库内置账户SA登录不了   设置SQL Server数据库给sa设置密码的时候  提示18456 解决步骤:   第二步:右击sa,选择属性: 第三步:点击状态选项卡:勾选授予 ...

  6. JS input文本框禁用右键和复制粘贴功能的代码

    代码如下: function click(e) { if (document.all) { ||||) { oncontextmenu='return false'; } } if (document ...

  7. 京东sdk商家上架接口调用问题总结(更新中...)

    前言: 最近在做商家发布产品,调用京东sdk,发现问题很多,而且还是在我同事的帮助下完成的,摸索中,菜鸟还请高手门多多提携才好,入正题 首先是引用jd的sdk啦,京东sdk中发布商品需要调用一个 36 ...

  8. Redis源码研究--启动过程

    ---------------------6月23日--------------------------- Redis启动入口即main函数在redis.c文件,伪代码如下: int main(int ...

  9. LANMP 如何禁止访问 .htaccess 文件

    很多朋友问我,为什么他已经在 Apache 规则里面加了禁止别人直接下载 .htaccess 文件,为什么还是可以下载? 其实这个很简单,因为 .htaccess 在 LANMP 环境下,当他作为文件 ...

  10. 基于php下载文件的详解

    本篇文章是对php下载文件进行了详细的分析介绍,需要的朋友参考下 php下载文件,比如txt文件. 出现的效果就是,弹出浏览器自带的下载框,出现另存为操作.有时候会出现内存溢出和超时的现象. 超时的话 ...