2014ACM集训13级PK赛4-80ers' Memory
来源:互联网 发布:阿里巴巴 淘宝便宜 编辑:程序博客网 时间:2024/06/07 11:28
Description
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 thei-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.
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
字符串匹配什么的,没难度,也算是个水题吧;
#include <string.h>#include <stdio.h>#include <stdlib.h>char s[101][30];int main(){ int N; scanf ("%d",&N); int i; for (i = 0;i < N;i++) { scanf ("%s",s[i]); } int N2; scanf ("%d",&N2); for (i = 0;i < N2;i++) { int n; int ans = 0; scanf ("%d",&n); for (int k = 0;k < n;k++) { char tmp[30]; scanf ("%s",tmp); for (int j = 0;j < N;j++) { if (!strcmp (tmp,s[j])) { ans++; break; } } } printf ("%d\n",ans); } return 0;}
- 2014ACM集训13级PK赛4-80ers' Memory
- 2014ACM集训13级PK赛4-K-Nice
- 2014ACM集训13级PK赛4-Light Bulb
- 2014寒假ACM集训13级PK赛-翻转排序
- 2014寒假ACM集训13级PK赛-购买矿石
- 2014ACM集训13级PK赛2-Somali Pirates
- 2014ACM集训13级PK赛2-Wu Xing
- 2014ACM集训13级PK赛2-Ordinal Numbers
- 2014ACM集训13级PK赛2-Conic Section
- 2014ACM集训13级PK赛2-Kagome Kagome
- 2014ACM集训13级PK赛2-Javabeans
- 2014ACM集训13级PK赛2-Median
- 2014ACM集训13级PK赛3-Taxi Fare
- 2014ACM集训13级PK赛3-Modular Inverse
- 2014ACM集训13级PK赛3-Friends
- 2014ACM集训13级PK赛3-Java Beans
- 2014ACM集训13级PK赛5-Easy Task
- 2014ACM集训13级PK赛4-Second-price Auction
- andriod Handler机制原理
- 1020. Tree Traversals
- 嵌入式系统开发的架构和应用
- 旋转
- 提示ADB server didn't ACK错误的解决方法
- 2014ACM集训13级PK赛4-80ers' Memory
- 常用PHP编辑器介绍
- Android开发中Intent意图对象使用方法
- AJAX简单使用介绍
- 第八届湘潭大学程序设计比赛(题解)
- c++中const限定符解读
- 【天道酬勤】 腾讯、百度、网易游戏、华为Offer及笔经面经
- Java面试宝典2013版(11版块1000题)
- java面试心得