SDUT1500 Message Flood
以前做过的用的字典树,可是貌似现在再用超内存。。。。求解释。。。
问了LYN用的map函数做的,又去小小的学了map函数。。。。
http://wenku.baidu.com/view/0b08cece05087632311212ba.html感觉这个写的挺详细的
http://wenku.baidu.com/view/d140cfcca1c7aa00b52acb46.html这个的话挺有意思,帮助理解
题目描述
输入
输出
示例输入
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的更多相关文章
- Message Flood
Message Flood Time Limit: 1500MS Memory limit: 65536K 题目描述 Well, how do you feel about mobile phone? ...
- Sicily 1194. Message Flood
题目地址:1194. Message Flood 思路: 不区分大小写,先全部转化为小写,用stl提供的函数做会很方便. 具体代码如下: #include <iostream> #incl ...
- STL 之map解决 Message Flood(原字典树问题)
Message Flood Time ...
- sdut Message Flood(c++ map)
用字典树没过,学习了一下map; 参考博客:http://blog.csdn.net/zhengnanlee/article/details/8962432 AC代码 #include<iost ...
- Message Flood(map)
http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=203#problem/D 以前用字典树做过 #include <strin ...
- oj1500(Message Flood)字典树
大意:输入几个字符串,然后再输入几个字符串,看第一次输入的字符串有多少没有在后面的字符串中出现(后输入的字符串不一定出现在之前的字符串中) #include <stdio.h> #incl ...
- SDUT 1500-Message Flood(set)
Message Flood Time Limit: 1500ms Memory limit: 65536K 有疑问?点这里^_^ 题目描写叙述 Well, how do you feel abo ...
- Eclipse 4.2 failed to start after TEE is installed
--------------- VM Arguments--------------- jvm_args: -Dosgi.requiredJavaVersion=1.6 -Dhelp.lucene ...
- 浅谈原始套接字 SOCK_RAW 的内幕及其应用(port scan, packet sniffer, syn flood, icmp flood)
一.SOCK_RAW 内幕 首先在讲SOCK_RAW 之前,先来看创建socket 的函数: int socket(int domain, int type, int protocol); domai ...
随机推荐
- 使用CInternetSession CHttpFile下载网页链接地址的文件
思路很清晰,使用CInternetSession创建CHttpFile对象.然后对该对象获取文件信息.进行文件读写操作均可. void DownloadFile(LPCTSTR szURL, LPCT ...
- tp中让头疼似懂非懂的create
项目中多次用到create() 只能它是表单验证,不过好出错,痛下心扉好好了解理解它的来龙去脉和所用的用法 一:通过create() 方法或者 赋值的方法生成数据对象,然后写入数据库 $model = ...
- 启动 mysql 失败 Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql'
Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' 这应该是某种情况下导致/usr/ ...
- Nginx的平滑重启和平滑升级
一,Nginx的平滑重启如果改变了Nginx的配置文件(nginx.conf),想重启Nginx,可以发送系统信号给Nginx主进程的方式来进行.在重启之前,要确认Nginx配置文件的语法是正确的. ...
- haproxy 安装与配置文件详解
本文主要阐述haproxy的安装配置详解,对于它的概念,作用,功能,和其它LB软件的区别,优点,缺点等不再进行说明. 一. haproxy 的安装配置 # cat /etc/redhat-releas ...
- 每日一“酷”之copy
Copy – 复制对象 作用:提供一些函数,可以使用浅副本或深副本语义复制对象. copy模块包括两个函数copy()和deepcopy(),用于复制现有的对象 1. 浅副本 copy()创建的浅副 ...
- 使用Qpython3制作老版天翼飞TP路由器拨号脚本
#幻境拨号python版 #by 1414641776 account='xxxxxx@96301' password='xxxxx' # 路由器脚本 def sendToRoute(account, ...
- 【转】 申请对齐某种结构体大小的buffer
在大多数情况下,编译器和C库透明地帮你处理对齐问题.POSIX 标明了通过malloc( ), calloc( ), 和 realloc( ) 返回的地址对于任何的C类型来说都是对齐的.在Linux中 ...
- WPF-控件-层级控件-TreeView
<?xml version="1.0" encoding="utf-8" ?> <Data xmlns=""> &l ...
- Jboss wildfly add JDBC driver
Jboss wildfly 添加 JDBC driver 我这里使用的是 wildfly-8.0.0.Final 第一步: 首先在modules里面添加mysql的驱动包 例如:modules\sy ...