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的更多相关文章

  1. ZOJ 3207 80ers' Memory(strcmp函数的用法)

    80ers' Memory Time Limit: 1 Second      Memory Limit: 32768 KB I guess most of us are so called 80er ...

  2. The 6th Zhejiang Provincial Collegiate Programming Contest->ProblemF:80ers' Memory

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3207 题意:给出N个关键字符串,然后给出k行,每行Ni个字符串,找出每行有 ...

  3. qdu_组队训练(ABCFIJK)

    A - Second-price Auction Do you know second-price auction? It's very simple but famous. In a second- ...

  4. 【NX二次开发】NX内部函数,libugui.dll文件中的内部函数

    本文分为两部分:"带参数的函数"和 "带修饰的函数". 浏览这篇博客前请先阅读: [NX二次开发]NX内部函数,查找内部函数的方法 带参数的函数: bool A ...

  5. HDU 3007 Buried memory & ZOJ 1450 Minimal Circle

    题意:给出n个点,求最小包围圆. 解法:这两天一直在学这个神奇的随机增量算法……看了这个http://soft.cs.tsinghua.edu.cn/blog/?q=node/1066之后自己写了好久 ...

  6. ZOJ 3686 A Simple Tree Problem

    A Simple Tree Problem Time Limit: 3 Seconds      Memory Limit: 65536 KB Given a rooted tree, each no ...

  7. ZOJ 1958. Friends

    题目链接: ZOJ 1958. Friends 题目简介: (1)题目中的集合由 A-Z 的大写字母组成,例如 "{ABC}" 的字符串表示 A,B,C 组成的集合. (2)用运算 ...

  8. ZOJ 2334 Monkey King

    并查集+左偏树.....合并的时候用左偏树,合并结束后吧父结点全部定成树的根节点,保证任意两个猴子都可以通过Find找到最厉害的猴子                       Monkey King ...

  9. ZOJ 3201 Tree of Tree

    树形DP.... Tree of Tree Time Limit: 1 Second      Memory Limit: 32768 KB You're given a tree with weig ...

随机推荐

  1. BCM_I2C函数更改

    版本:sdk-xgs-robo- 平台:BCM53344 应用:控制POE芯片 描述:POE控制芯片使用PD69200,使用i2c与其通信,每次需要发送15字节数据,并接受15字节的返回数据. 1.更 ...

  2. JDK中的序列化和反序列化

    题外话:诸事缠身,不知不觉距离上一篇就将近一个月了,读书不易,学习不易,唯有坚持. 写来写去始终不满意,索性贴一个比较好的文章吧! 参考: [Java基础]序列化与反序列化深入分析

  3. (转)_declspec(dllexport)

    先看代码:以下是在dev-c++里建立自已的dll时的dll.h里面的代码,这里面有一个:_declspec(dllexport) #ifndef _DLL_H_#define _DLL_H_//防重 ...

  4. 关于VS2012连接MySql数据库时无法选择数据源

    您的C#开发工具是用VS2012吗?    No! return;    您的数据库用的是MySql吗?     No! return;    您新建ADO.NET数据实体模型的时候选择数据源的时候没 ...

  5. erlang 自定义函数的初步应用

    一.模块内调用 1> AA=fun(BB)-> io:format("this is test args ~s~n",[BB]) end.#Fun<erl_eva ...

  6. R语言绘图边框

    在R语言中, 绘图边框一共有3个区域: device region : figure region : plot region   : 在描述不同区域大小的时候,有对应的不同参数: din : 返回d ...

  7. 【Java NIO的深入研究1】缓冲区

    缓冲区 传统的流和通道的对比 流 通道 慢 快 处理简单 处理复杂 单字节的传输 一块数据的传输 - Java.io.*已经重新写过 - 是对流的模拟 单向的 双向的 可直接访问 必须通过Buffer ...

  8. c++ 向main传递参赛

    1.今天写了个批处理文件 准备向main传递参赛  发现在vs2008运行正常 vs2010运行只有首字母 2.需要在项目--属性--常规-字符集里面设置成多字节就好了,以前是unicode 3.因为 ...

  9. Android SDK的安装教程

      Android4.1虽说已经发布了好些天,但由于的我手机比较坑,系统依旧保持在2.3.4.0的都是可望不可即的了,就别说4.1.由于资金的问题,没法换手机,只能另想方法,通过在笔记本上装andro ...

  10. 使用Visual Studio将C#生成DLL文件的方法

    1.命令方式 打开Visual Studio安装目录下的开发人员命令提示 译 File.cs 以产生 File.exe csc File.cs 编译 File.cs 以产生 File.dll csc ...