ZCMU新人训练赛F
来源:互联网 发布:云计算与大数据 idc 编辑:程序博客网 时间:2024/05/16 16:13
F - 80ers' Memory ZOJ - 3207
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 beNi words separated by white spaces. Each of these words has no more than 20 characters.
All the words are case sensitive.
<strong< dd="">
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.
<strong< dd="">
Sample Input 4Saint_SeiyaYoYo_ballSuper_MarioHuLuWa32 Saint_Seiya TiaoFangZi1 KTV3 HuLuWa YOYO_BALL YoYo_ball
<strong< dd="">
Sample Output 102
AC代码:
#include<iostream>#include<cstdio>#include<string.h>#include<cstring>#include<queue>#include<vector>#include<set>#include<stack>#include<map>#include<climits>using namespace std;#define LL long longint main(){ char ch[110][30],s[30]; int n; while(scanf("%d",&n)!=EOF) { for(int i=0;i<n;i++) scanf("%s",ch[i]); int m; 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;}
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?
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 beNi words separated by white spaces. Each of these words has no more than 20 characters.
All the words are case sensitive.
<strong< dd="">
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.
<strong< dd="">
4Saint_SeiyaYoYo_ballSuper_MarioHuLuWa32 Saint_Seiya TiaoFangZi1 KTV3 HuLuWa YOYO_BALL YoYo_ball
<strong< dd="">
102
AC代码:
#include<iostream>#include<cstdio>#include<string.h>#include<cstring>#include<queue>#include<vector>#include<set>#include<stack>#include<map>#include<climits>using namespace std;#define LL long longint main(){ char ch[110][30],s[30]; int n; while(scanf("%d",&n)!=EOF) { for(int i=0;i<n;i++) scanf("%s",ch[i]); int m; 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;}
- ZCMU新人训练赛F
- ZCMU新人训练赛A
- ZCMU新人训练赛J
- ZCMU新人训练赛K
- ZCMU新人训练赛A
- ZCMU新人训练赛A
- ZCMU新人训练赛B
- ZCMU新人训练赛I
- ZCMU新人训练赛J
- ZCMU新人训练赛B
- ZCMU-训练赛-A
- ZCMU-训练赛-Primary Arithmetic
- ZCMU-训练赛-Problem A: Freckles
- 省赛训练F 广搜
- 【NYIST】暑假训练赛 (一)----Problem F
- hpu暑假训练F
- 2013 - ECJTU 暑期训练赛第三场-problem-F
- 2013 - ECJTU 暑期训练赛第四场-problem-F
- 我是如何学会英语的
- jQuery中实现表格的增、删、改操作
- 泛型通配符
- 极大似然和交叉熵 | 深度学习
- leetcode(494). Target Sum
- ZCMU新人训练赛F
- SQLyog恢复数据库报错解决方法【Error Code: 2006
- 函数式编程简单记忆
- 选择排序
- 安装ssh -server 完不能启动服务的问题
- 404. Sum of Left Leaves
- HDU 2476 区间DP--转移思考方向
- 实时计算 流数据处理系统简单分析
- CSS学习笔记二:css 画立体图形