HDU 3150 Robot Roll Call – Cambot…Servo…Gypsy…Croooow(map)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3150
Mystery Science Theater 3000 is about to start, which means it's time for "Robot Roll Call", where the name of each robot is called out, as per the list received from Earth. The expectation is that if a robot is there, it will respond by adding its name to
a data stream which is then sent back to Earth. Unfortunately today, once the roll is received, communication with Earth is temporarily lost. In the meantime, the robots that are present for roll call have saved their names to the data stream. However, lots
of other things are also being saved to this same stream. To help extract data later, any data placed in the stream is separated by whitespace. Once the communication problems are resolved, the contents of this stream are relayed to Earth.
Your task is as follows. Given a list of names for roll call, you must scan the accompanying data stream and determine if a given name is there. For each name that is in the roll call, report whether or not that name was in the data stream. For a name to be
a match, it must appear EXACTLY as shown in the roll. This means a match is case-sensitive and sub-string matches are not allowed.
< n < 26) representing the number of names in the roll. On the lines that follow will be n entries, one per line, containing the individual names in the roll. No name will have more than 25 characters. Names will only contain
the characters A-Z, a-z, and 0-9. Names will be unique.
Following the names will be an integer d (0 < d < 100) representing the number of lines in the data stream. On each subsequent line will be the characters that make up the data stream. Each line of the data stream will contain
at least one character and at most 100. Furthermore, the data on a given line will be separated by whitespace (space, tab, or combination of the two). Finally, any names from the roll that might occur as part of the data stream will be found on one line (a
name will not be split across lines).
case. Output format must be identical to the sample output shown below.
2
4
Gypsy
TomServo
CrowTRobot
Cambot
2
Manos Torgo Joel 101010 Gypsy tomservo
Fugitive Alien Time of the Apes crowTrobot Cambot
2
R2D2
C3PO
1
Boba Fett c3Po R2D22 Jar Jar Binks Luke give in to the dark side
Test set 1:
Gypsy is present
TomServo is absent
CrowTRobot is absent
Cambot is present
Test set 2:
R2D2 is absent
C3PO is absent
PS:
推断给出的表单是否在以下有出现!
代码例如以下:
#include <cstdio>
#include <map>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
map<string,int>mm;
int main()
{
string name[117];
int t;
int n;
int cas = 0;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
mm.clear();
for(int i = 0; i < n; i++)
{
cin>>name[i];
}
int m;
scanf("%d",&m);
char s[1000];
string ss="";
for(int i = 0; i < m; i++)
{ getchar();
gets(s);
for(int j = 0; j < strlen(s); j++)
{
if(s[j]==' ')
{
mm[ss]++;
ss="";
continue;
}
ss+=s[j];
}
mm[ss]++;
ss="";
}
printf("Test set %d:\n",++cas);
for(int i = 0 ; i < n; i++)
{
if(mm[name[i]])
{
//printf("%s is present\n",name[i]);
cout<<name[i]<<" is present"<<endl;
}
else
{
//printf("%s is absent\n",name[i]);
cout<<name[i]<<" is absent"<<endl;
}
}
printf("\n");
}
return 0;
}
HDU 3150 Robot Roll Call – Cambot…Servo…Gypsy…Croooow(map)的更多相关文章
- HDU 4504 威威猫系列故事——篮球梦(dp)
http://acm.hdu.edu.cn/showproblem.php?pid=4504 题目大意: 中文都看得懂.不过我是看hint才正确理解什么意思的.开始的时候理解错了. 解题思路: 给定时 ...
- robot framework学习笔记之一 资源文件(Resource)和外部资源(External Resources)
一.资源文件(Resource) 测试套件主要是存放测试案例,资源文件主要是用来存放用户关键字. 添加资源 在目录型的Project/Test Suite下单击鼠标右键,选择『New Resou ...
- hdu 1800 (map)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1800 Flying to the Mars Time Limit: 5000/1000 MS (Java/ ...
- HDU 5716 带可选字符的多字符串匹配(ShiftAnd)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5716 [题目大意] 给出一个字符串,找出其中所有的符合特定模式的子串位置,符合特定模式是指,该子串 ...
- HDU 5095 Linearization of the kernel functions in SVM(模拟)
主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=5095 Problem Description SVM(Support Vector Machine) ...
- hdu Word Amalgamation(map)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1113 找单词 #include <iostream> #include <strin ...
- hdu What Are You Talking About(map)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 map简单应用 代码: #include <stdio.h> #include &l ...
- HDU 1263:水果(map)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1263 #include <stdio.h> #include <string.h&g ...
- 【hdu 2112】 HDU Today ( 最短路 Dijkstra)(map)
http://acm.hdu.edu.cn/showproblem.php?pid=2112 这道题给了一个将字符串与int对应的思路,就是使用map 这道题答案对了,但是没有AC,我也不知道为什么. ...
随机推荐
- java自动化测试开发环境搭建(更新至2018年10月8日 11:42:15)
1.安装JDK的1.8版本 官网下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151 ...
- Windows下MySQL8.0.11.0安装教程
1.mysql下载地址:https://dev.mysql.com/downloads/installer/ 2.下载安装MySQL 8.0.11.0 https://cdn.mysql.com//D ...
- MySql 存储过程实例(附完整注释)(转)
MySql 存储过程实例(附完整注释) 将下面的语句复制粘贴可以一次性执行完,我已经测试过,没有问题! MySql存储过程简单实例: ...
- [luogu2044][NOI2012] 随机数生成器 [矩阵快速幂]
题面: 传送门 思路: 看一眼这个公式: $x\left[n+1\right]=\left(a\ast x\left[n\right]+c\right) mod m$ 递推,数据范围$n\leq 10 ...
- mongoDB权威指南学习笔记
//mongoDB第1-3章节添加,修改,修改器的笔记: //备注:和MySQL查询一样,时刻想着优化查询数据的时间和性能 //db.help() //数据库帮助信息 //db.blog.help() ...
- Vijos[1028]魔族密码
风之子刚走进他的考场,就……花花:当当当当~~偶是魅力女皇——花花!!^^(华丽出场,礼炮,鲜花)风之子:我呕……(杀死人的眼神)快说题目!否则……-_-###花花:……咦~~好冷~~我们现在要解决的 ...
- JavaScript内部是这样运行
编译阶段 词法分析(Lexing) 这个过程会将由字符组成的字符串分解成(对编程语言来说)有意义的代码块,这些代 码块被称为词法单元(token). 简单举个例子:c = b - a 转换为 NAME ...
- 例说linux内核与应用数据通信系列【转】
转自:http://blog.csdn.net/shallnet/article/details/47865169 版权声明:本文为博主原创文章,未经博主允许不得转载.如果您觉得文章对您有用,请点击文 ...
- linux根文件系统制作之busybox编译和系统构建【转】
转自:http://blog.chinaunix.net/uid-29401328-id-5019660.html 介绍完相关文件后我们开始构建文件系统,涉及到的文件等到具体用到的时候再讲. 一.编译 ...
- hdu 2685(数论相关定理+欧几里德定理+快速取模)
I won't tell you this is about number theory Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...