SDUT 1500-Message Flood(set)
Message Flood
Time Limit: 1500ms Memory limit: 65536K 有疑问?点这里^_^
题目描写叙述
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.
输入
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.
输出
演示样例输入
5 3
Inkfish
Henry
Carp
Max
Jericho
Carp
Max
Carp
0
演示样例输出
3
来源
#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)的更多相关文章
- 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 ...
- SDUT1500 Message Flood
以前做过的用的字典树,可是貌似现在再用超内存....求解释... 问了LYN用的map函数做的,又去小小的学了map函数.... http://wenku.baidu.com/view/0b08cec ...
- 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 ...
- Checkstyle-Configuration
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module PUBLIC "-/ ...
- 富文本插件tinymce初始化配置参数说明
{ language: _this.language, // 显示语种 selector: #${_this.tinymceId}, // 容器的id height: _this.height, // ...
随机推荐
- Winform 异步调用
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- SqlMap常用参数(一)
sqlmap可谓是利用sql注入的神器了,sqlmap的参数很多,接下介绍几种常见的参数. 一.注入access数据库常用的参数 sqlmap.py -u "url" //判断参 ...
- 常见文件MIME类型
常见文件MIME类型.asx,video/x-ms-asf .xml,text/xml .tsv,text/tab-separated-values .ra,audio/x-pn-realaudio ...
- jquery中的left和top
left 和 top /*1. 获取元素基于定位容器的位置*/ /*返回的是对象 属性 left top */ var position = $('.inner').position(); conso ...
- var _this = this 是干什么的
因为JS可以多层嵌套代码可能下面还可以再嵌一个方法引用this就会变成子方法控制的对象如果需要上级的对象在没有参数的情况下前面前提做了一个临时变量_this可以保存上级对象子方法中就可以用_this来 ...
- for 循环 乘法口诀表
用for循环写乘法口诀表: for(var i = 1; i <= 9; i++) { var c=''; for(var x = 1; x <= i; x++) { c=c+x+' ...
- 搭建Hive所遇到的坑
##一.基本功能: 1.启动hive时报错 java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Metho ...
- 11.03 在外链接中用OR逻辑
select e.ename,d.deptno,d.dname,d.locfrom dept d left join emp e on(d.deptno = e.deptnoand (e.deptno ...
- Tomcat 服务器中jsp页面乱码
<Connector port="80" protocol="HTTP/1.1" connectionTimeout=&quo ...
- iphone 事件冒泡规则
今天碰到的一个比较烦人的问题是,在body上添加事件处理函数,发现在iphone上怎么也没办法触发事件,找了半天,发现iPhone处理冒泡事件的规则: 1.点击某个元素: 2.如果这个元素上没有处理该 ...