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 ...
随机推荐
- jQuery的Ajax操作小结——$.ajax和$.getJSON等用法小结
一.$.ajax用法与举例 jQuery.ajax(url,[settings]) ——返回值:XMLHttpRequest 通过 HTTP 请求加载远程数据,这个是jQuery 的底层 AJ ...
- CentOS基础命令大全
1.关机 (系统的关机.重启以及登出 ) 的命令 shutdown -h now 关闭系统(1) init 0 关闭系统(2) telinit 0 关闭系统(3) shutdown -h hours: ...
- 让Flask-admin支持markdown编辑器
前言 flask-admin 算是一个很不错的 flask 后台管理了,用它来做博客系统的管理后端再合适不过了,节约时间成本,避免重复造轮子,但是作为一个程序员,写文章怎么可以没有 markdown ...
- CS文件类头注释
1.修改unity生成CS文件的模板(模板位置:Unity\Editor\Data\Resources\ScriptTemplates 文件名:81-C# Script-NewBehaviourScr ...
- Unity3D的Time.timeScale
(1)Time.timeScale = 0可以暂停游戏,Time.timeScale = 1恢复正常,但这是作用于整个游戏的设置,不单单是当前场景,记得在需要的时候重置回Time.timeScale ...
- MathType中常见的两种符号的运用
想要让公式编辑得快速又高效,MathType数学公式编辑器这个神助攻是少不了的.MathType是一款专用的数学公式编辑器,用它来编辑公式非常方便实用,并且排版也非常简单.下面介绍两种常见符号的应用. ...
- ros-indigo-desktop-full安装到ubuntu14.04
一.安装ros(原创博文,转载请标明出处-周学伟http://www.cnblogs.com/zxouxuewei/) 1.配置ubuntu的软件仓库.(可以不用进行配置). 配置你的 Ubuntu ...
- 发布订阅者模式之C#委托实现
1 ...
- 工具类之数据库工具类:DBUtil(採用反射机制)
常常操作数据库的码农们一定知道操作数据库是一项非常复杂的工作.它不仅要解决各种乱码的问题还要解决各种数据表的增删改查等的操作. 另外每次操作数据库都要用到数据库连接.运行SQL语句.关闭连接的操作.所 ...
- swift--动画效果
一.for循环创建4*4个view,然后对立面的所有view进行动画,这里列集中动画的效果: 1,旋转动画 for tile in backgrounds{ //现将数字块大小职位原始尺寸的1/10 ...