ZCMU新人训练赛F
2017-08-03 22:28
253 查看
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 groupof 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?InputThere 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 whitespaces. Each of these words has no more than 20 characters.All the words are case sensitive.<strong< dd="">OutputFor each of these K people, you are asked to count the number of typical 80ers' keywordson his/her list and output it in a single line.<strong< dd="">Sample Input
4 Saint_Seiya YoYo_ball Super_Mario HuLuWa 3 2 Saint_Seiya TiaoFangZi 1 KTV 3 HuLuWa YOYO_BALL YoYo_ball<strong< dd="">Sample Output
1 0 2
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新人训练赛A
- ZCMU新人训练赛A
- ZCMU新人训练赛B
- ZCMU新人训练赛A
- ZCMU新人训练赛B
- ZCMU新人训练赛J
- ZCMU新人训练赛I
- ZCMU新人训练赛K
- ZCMU新人训练赛J
- ZCMU-训练赛-Primary Arithmetic
- ZCMU-训练赛-Problem A: Freckles
- ZCMU-训练赛-A
- 新人建站如何选择适合自己的开发语言或者开发程序?
- 为什么企业不愿意招聘新人
- 新人报道~
- 中油瑞飞新人
- 魅族MX简单实用小技巧+使用启示+新人必看
- 《转》用人单位与职场新人的四大分歧
- ACM/ICPC学习新人向导新手必读[转--算法学习推荐]
- 给IT新人的15点建议:苦逼程序员的辛酸反省与总结