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

Author: GAO, Fei
Source: The 6th Zhejiang Provincial Collegiate Programming Contest

#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char str[][];
int n,k;
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
scanf("%s",&str[i]);
scanf("%d",&k);
for(int i=;i<=k;i++)
{
int x,ans=;
scanf("%d",&x);
for(;x>;x--)
{
char ch[];
scanf("%s",&ch);
for(int j=;j<=n;j++)
if (!strcmp(ch,str[j])) {ans++; break;}
}
printf("%d\n",ans);
}
return ;
}

ZOJ 3207 80ers' Memory(strcmp函数的用法)的更多相关文章

  1. 关于strcmp函数的用法

    strcmp函数是在string.h库下的han函数, 具体用法如下: strcmp函数是用来比较2个字符串的函数,如srcmp(字如果符串1,字符串2),从第一个字符开始比较,如果到最后两个字符串完 ...

  2. strcmp函数和memcmp函数的用法区别及联系

    前言: C语言中有很多东西容易搞混,最近笔者就遇到了一个问题.这里做个记录.就是memcmp和strcmp两者的用法,这里做个对比: 功能对比: A memcmp: 函数原型: int memcmp( ...

  3. ZOJ 80ers' Memory

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

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

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

  5. qsort函数的用法

    qsort函数的用法   qsort 功 能: 使用快速排序例程进行排序  用 法: void qsort(void *base, int nelem, int width, int (*fcmp)( ...

  6. C语言 · 实现strcmp函数 · 字符串比较

    蓝桥杯练习场上碰到两个此类题了: 算法提高 11-1实现strcmp函数   时间限制:1.0s   内存限制:256.0MB      问题描述 自己实现一个比较字符串大小的函数,也即实现strcm ...

  7. tensorflow.nn.bidirectional_dynamic_rnn()函数的用法

    在分析Attention-over-attention源码过程中,对于tensorflow.nn.bidirectional_dynamic_rnn()函数的总结: 首先来看一下,函数: def bi ...

  8. C/C++ sort函数的用法

    sort函数的用法(#include<algorithm>) 做ACM题的时候,排序是一种经常要用到的操作.如果每次都自己写个冒泡之类的O(n^2)排序,不但程序容易超时,而且浪费宝贵的比 ...

  9. 有关日期的函数操作用法总结,to_date(),trunc(),add_months();

    相关知识链接: Oracle trunc()函数的用法 oracle add_months函数 Oracle日期格式转换,tochar(),todate() №2:取得当前日期是一个星期中的第几天,注 ...

随机推荐

  1. Appium 输入中文

    文章出处 http://www.cnblogs.com/ljfight/p/6089163.html 在做app自动化过程中会踩很多坑,咱们都是用中文的app,所以首先要解决中文输入的问题!本篇通过屏 ...

  2. JS 中的substring ,substr ,slice,split,join

    substr with different arguments passed in: str.substring(startNum,stopNum ); str.slice(startNum,stop ...

  3. LeetCode:二叉搜索树中第K小的数【230】

    LeetCode:二叉搜索树中第K小的数[230] 题目描述 给定一个二叉搜索树,编写一个函数 kthSmallest 来查找其中第 k 个最小的元素. 说明:你可以假设 k 总是有效的,1 ≤ k ...

  4. Spring4.2.3+Hibernate4.3.11整合( IntelliJ maven项目)(使用Annotation注解)(Junit测试类)

    1. 在IntelliJ中新建maven项目 给出一个建好的示例 2. 在pom.xml中配置依赖 包括: spring-context spring-orm hibernate-core mysql ...

  5. Flume1.7.0概述

    Flume概述 常见的开源数据收集系统有: 非结构数据(日志)收集 Flume 结构化数据收集(传统数据库与 Hadoop 同步) Sqoop:全量导入 Canal(alibaba):增量导入 Dat ...

  6. hadoop14---centos 安装activemq

    创建activemq目录 [root@node1 ~]# mkdir -p /usr/local/activemq 狐火下载activemq,从用户/download目录把文件cp到/usr/loca ...

  7. make cmake catkin_make

    在Linux下进行C语言编程,必然要采用GNU GCC来编译C源代码生成可执行程序. 一.GCC快速入门 Gcc指令的一般格式为:Gcc [选项] 要编译的文件 [选项] [目标文件] 其中,目标文件 ...

  8. 正则表达式:Python3中的应用简介

    正则表达式:Python3中的应用简介 一.正则表达式 1,概述 正则表达式,又称规则表达式.(英语:Regular Expression,在代码中常简写为regex.regexp或RE),计算机科学 ...

  9. shell 中的 eval 及 crontab 命令

    eval eval会对后面的命令进行两遍扫描,如果第一遍扫描后,命令是个普通命令,则执行此命令:如果命令中含有变量的间接引用,则保证间接引用的语义.也就是说,eval命令将会首先扫描命令行进行所有的置 ...

  10. 20145217《网络对抗》web基础

    20145217<网络对抗>web基础 一.问题 1.什么是表单? 表单:可以收集用户的信息和反馈意见,是网站管理者与浏览者之间沟通的桥梁. 表单包括两个部分:一部分是HTML源代码用于描 ...