ZOJ3207-80ers' Memory
来源:互联网 发布:js如何给radio赋值 编辑:程序博客网 时间:2024/06/08 14:57
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
4Saint_SeiyaYoYo_ballSuper_MarioHuLuWa32 Saint_Seiya TiaoFangZi1 KTV3 HuLuWa YOYO_BALL YoYo_ball
Sample Output
102
Author: GAO, Fei
Source: The 6th Zhejiang Provincial Collegiate Programming Contest
题意:第一行为一个正整数N(1<=N<100)。以下N行每行一个关键单词,由字母,数字或下划线构成。接下来一个正整数K(1<=K<100)。以下K行每行第一个数为Ni,表示该行有Ni个单词,接下来是这Ni个单词,每个单词之间用空格分隔。对于K行的每一行,输出每行含有多少个关键单词。
#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <algorithm>#include <queue>#include <vector>#include <set>#include <stack>#include <map>#include <climits>using namespace std;#define LL long longint main(){ char ch[109][30],s[30]; int n,m; while(~scanf("%d",&n)) { for(int i=0; i<n; i++) scanf("%s",ch[i]); scanf("%d",&m); while(m--) { int a,sum=0; scanf("%d",&a); for(int i=0;i<a;i++) { scanf("%s",s); for(int j=0; j<n; j++) if(strcmp(s,ch[j])==0) sum++; } printf("%d\n",sum); } } return 0;}
- ZOJ3207 80ers' Memory
- ZOJ3207-80ers' Memory
- 80ers' Memory
- 80ers' Memory
- ZOJ 80ers' Memory
- F. 80ers' Memory
- zoj 3211 80ers' Memory
- ZOJ#3207:80ers' Memory
- zoj 3207 80ers' Memory(水~)
- 省赛热身赛之80ers' Memory
- ZOJ3207
- ZOJ-3207-80ers' Memory【6th浙江省赛】【STL】
- ZOJ 320780ers' Memory(STL)
- 2014ACM集训13级PK赛4-80ers' Memory
- The 6th Zhejiang Provincial Collegiate Programming Contest->ProblemF:80ers' Memory
- The 6th Zhejiang Provincial Collegiate Programming Contest->ProblemF:80ers' Memory
- ERS Precise Orbit Determination: Orbits
- 读取ERS 格式说明网址
- java 中的集合(十四) TreeMap源码分析
- 聊天室服务器基本代码
- Linux下socket编程,附带tcp例子
- 九度OJ题目1439:Least Common Multiple
- java练习--集合-List书店购物车
- ZOJ3207-80ers' Memory
- 粒子群算法
- spark的数据存储
- 浅谈路径规划算法之SPFA算法
- POJ
- 合并两个排序的链表
- Kaggle 上一个用户分类问题
- 数据库基础概念
- SOCKET类型定义及应用。