ZOJ 80ers' Memory
80ers' Memory
Time Limit: 1 Second Memory Limit: 32768 KB
I guess most of us are so called 80ers, which means that we were born in the 1980's. This group of people shared a lot of common memories. For example, the Saint Seiya, the YoYo ball,
the Super Mario, and so on. Do you still remember these?
Input
There will be ONLY ONE test case.
The test case begins with a positive integer N, (N < 100).
Then there will be N lines each containing a single word describing a keyword of the typical 80ers' memories. Each word consists of letters, [a-zA-Z], numbers, [0-9], and the underline, '_'. The length of each word would be no more than 20.
Then one line follows with a positive integer K, (K < 100).
The last part of the test case will be K lines. The i-th line contains the keywords given by the i-th person and starts with a positive integer Ni. Then there will be Ni words separated by white
spaces. Each of these words has no more than 20 characters.
All the words are case sensitive.
Output
For each of these K people, you are asked to count the number of typical 80ers' keywords on his/her list and output it in a single line.
Sample Input
4
Saint_Seiya
YoYo_ball
Super_Mario
HuLuWa
3
2 Saint_Seiya TiaoFangZi
1 KTV
3 HuLuWa YOYO_BALL YoYo_ball
Sample Output
1
0 2#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <string> using namespace std;
int n,k,m;
map<string,int> a;
string b[105];
int main()
{
scanf("%d",&n);
string s;
for(int i=1;i<=n;i++)
{
cin>>s;
a[s]=1;
}
scanf("%d",&k);
int ans=0;
for(int i=1;i<=k;i++)
{
ans=0;
scanf("%d",&m);
for(int j=1;j<=m;j++)
{
cin>>s;
if(a[s]!=0)
ans++;
}
printf("%d\n",ans);
}
return 0;
}
ZOJ 80ers' Memory的更多相关文章
- ZOJ 3207 80ers' Memory(strcmp函数的用法)
80ers' Memory Time Limit: 1 Second Memory Limit: 32768 KB I guess most of us are so called 80er ...
- The 6th Zhejiang Provincial Collegiate Programming Contest->ProblemF:80ers' Memory
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3207 题意:给出N个关键字符串,然后给出k行,每行Ni个字符串,找出每行有 ...
- qdu_组队训练(ABCFIJK)
A - Second-price Auction Do you know second-price auction? It's very simple but famous. In a second- ...
- 【NX二次开发】NX内部函数,libugui.dll文件中的内部函数
本文分为两部分:"带参数的函数"和 "带修饰的函数". 浏览这篇博客前请先阅读: [NX二次开发]NX内部函数,查找内部函数的方法 带参数的函数: bool A ...
- HDU 3007 Buried memory & ZOJ 1450 Minimal Circle
题意:给出n个点,求最小包围圆. 解法:这两天一直在学这个神奇的随机增量算法……看了这个http://soft.cs.tsinghua.edu.cn/blog/?q=node/1066之后自己写了好久 ...
- ZOJ 3686 A Simple Tree Problem
A Simple Tree Problem Time Limit: 3 Seconds Memory Limit: 65536 KB Given a rooted tree, each no ...
- ZOJ 1958. Friends
题目链接: ZOJ 1958. Friends 题目简介: (1)题目中的集合由 A-Z 的大写字母组成,例如 "{ABC}" 的字符串表示 A,B,C 组成的集合. (2)用运算 ...
- ZOJ 2334 Monkey King
并查集+左偏树.....合并的时候用左偏树,合并结束后吧父结点全部定成树的根节点,保证任意两个猴子都可以通过Find找到最厉害的猴子 Monkey King ...
- ZOJ 3201 Tree of Tree
树形DP.... Tree of Tree Time Limit: 1 Second Memory Limit: 32768 KB You're given a tree with weig ...
随机推荐
- Zookeeper 应用程序
Zookeeper为分布式环境提供灵活的协调基础架构.ZooKeeper框架支持许多当今最好的工业应用程序.我们将在本章中讨论ZooKeeper的一些最显着的应用. 雅虎 ZooKeeper框架最初是 ...
- Android 利用cursor来进行排序(转至http://blog.csdn.net/yangzongquan/article/details/6547860)
主要思路是:override move系列的方法,让cursor以自己想要的顺序来移动,从而达到对cursor排序的目的.比如数组A0里有 4(0),3(1),1(2),2(3),括号内为位置,排序后 ...
- Python C :ctypes库
>>> import ctypes >>> from ctypes import * >>> dir(ctypes) ['ARRAY', 'Arg ...
- NET Core 环境搭建和命令行CLI入门[转]
NET Core 环境搭建和命令行CLI入门 时间:2016-07-06 01:48:19 阅读:258 评论:0 收藏:0 [点我收藏+] 标签: N ...
- 第三章 Spring.Net 环境准备和搭建
在前面一章我们介绍了依赖注入,控制反转的概念.接下来我们来真正动手搭建一下Spring.Net的环境,看一下Spring.Net 中的控制反转和依赖注入是什么样子. 3.1 Spring.Net 下 ...
- 从头认识java-16.5 nio的数据转换
这一章节我们来讨论一些nio的数据转换. 上面一章节我们提到ByteBuffer,可是他是面向二进制数据,对于编程来说不是非常方便,因此,java添加了转换数据的工具. 1.asCharBuffer ...
- mybatis由浅入深day01_4入门程序_4.6根据用户id(主键)查询用户信息
4 入门程序 4.1 需求 根据用户id(主键)查询用户信息 根据用户名称模糊查询用户信息 添加用户 删除 用户 更新用户 4.2 环境 java环境:jdk1.7.0_72 eclipse:indi ...
- 工作流JBPM_day02:3-预定义的活动1_4-预定义的活动2+在图片上高亮显示正在执行的上活动
工作流JBPM_day02:3-预定义的活动1 工作流JBPM_day02:4-预定义的活动2+在图片上高亮显示正在执行的上活动 活动 Activity 预先定义好的活动 Start开始活动 End结 ...
- python2.0_s12_day19_前端结合后端展示客户咨询纪录
接下来就是将后台视图与前端页面结合起来了完成后台系统了.实现前端展示用户列表1.先在base.html代码中把模版中Dashboard下面的内容清空,如下: 具体删除哪些html代码,自己找吧.2.我 ...
- laravel windows下安装 gulp 和 laravel-elixir
1)首先,确定一下你装了nodejs和npm了没?没装的话,到官网去下载最新版,传送门:https://nodejs.org/en/ npm 不需要单独安装,安装完 nodejs 就自带 npm 的了 ...