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. 【转】WCF入门教程三[WCF的宿主]

    一.WCF服务应用程序与WCF服务库 我们在平时开发的过程中常用的项目类型有“WCF 服务应用程序”和“WCF服务库”. WCF服务应用程序,是一个可以执行的程序,它有独立的进程,WCF服务类契约的定 ...

  2. 【转】MFC WM_USER和WM_APP

    WM_USER常量是Windows帮助应用程序定义私有窗口类里的私有消息,通常使用WM_USER+一个整数值,但总值不能超过0x7FFF. #define WM_USER       0x0400 W ...

  3. C语言中预处理器的相关知识:

    预处理过程时,会做以下事情或着更多: 将所有的#define删除,并且展开所有的宏定义: 处理所有条件编译指令,如#if,#ifdef等: 处理#include预编译指令,将被包含的文件插入到该预编译 ...

  4. com.sun.awt.AWTUtilities.setWindowOpacity相关说明

    在eclipse中(jdk1.6.*)版本中出现编译不通过而报错,报错是因为这个包里面的方法不属于jdk正式版本,也就是不能保证下个版本还存在,所以编译器会拒绝,你可以在eclipse中如下设置: 选 ...

  5. (转)RTP协议全解(H264码流和PS流)

    写在前面:RTP的解析,网上找了很多资料,但是都不全,所以我力图整理出一个比较全面的解析, 其中借鉴了很多文章,我都列在了文章最后,在此表示感谢. 互联网的发展离不开大家的无私奉献,我决定从我做起,希 ...

  6. Python使用paramiko库远程安全连接SSH

    #!/usr/bin/python #ssh import paramiko import sys,os host='127.0.0.1' user = 'whl' password = ' s = ...

  7. FairyGUI学习

    官网:http://www.fairygui.com/ 教程:http://www.taikr.com/course/446/tasks 博客:http://gad.qq.com/article/de ...

  8. linux,shell脚本中获取脚本的名字,使用脚本的名字。

    需求描述: 写shell脚本的过程中,有时会需要获取脚本的名字,比如,有的时候,脚本 中会有usage()这种函数,可能就会用到脚本的名字. 实现方法: shell脚本中,通过使用$0就可以获取到脚本 ...

  9. pcduino 无法打开usb摄像头。

    1.sudo ./demon   http://www.oschina.net/question/994181_118098 2.usb camera interfarce switch :http: ...

  10. BZOJ 1089 SCOI2003 严格n元树 动态规划+高精度

    题目大意:定义一棵深度为d的严格n元树为根的深度为0,最深的节点深度为d,且每一个非叶节点都有恰好n个子节点的树 给定n和d,求深度为d的严格n元树一共同拥有多少种 此题的递推部分并不难 首先我们设深 ...