ZOJ 3207 ( F)
来源:互联网 发布:bt.gg新域名 编辑:程序博客网 时间:2024/06/06 17:12
#include<iostream>#include<cstdio>#include<string>#include<vector>#include<algorithm>using namespace std;vector<string>q;int main(){#ifdef CDZSCfreopen("i.txt", "r",stdin);#endifstring s;int t, n,m;while (~scanf("%d", &t)){while (t--){cin >> s;q.push_back(s);}scanf("%d", &n);while (n--){int ans = 0;scanf("%d", &m);while (m--){cin >> s;vector<string>::iterator it;for (it = q.begin(); it != q.end(); it++){if (*it == s)ans++;}}printf("%d\n", ans);}}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?
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
- ZOJ 3207 ( F)
- ZOJ 2970 水(F)
- ZOJ 3492 F - Kagome Kagome
- ZOJ 3330 Country F 无根树同构
- zoj 2592 Think Positive(5-F)
- ZOJ Monthly, June 2014 F - First Digit
- ZOJ 3605-F - Find the Marble-DP
- ZJU2012.02月赛 F题(ZOJ 3576)
- zoj Nov. 2012 月赛 F题 Japanese Mahjong III
- zoj 2709 Lottery 组合数,概率,贪心 (8-F)
- ZOJ 3814 / 2014 牡丹江赛区网络赛 F. Sawtooth Puzzle
- ZOJ 3814 Sawtooth Puzzle(牡丹江网络赛F题)
- 2014牡丹江 现场赛 F zoj 3824 Fiber-optic Network
- ZOJ Monthly, February 2012 C,D,F,H
- 浙江14届省赛 F.Heap Partition(ZOJ 3963)[贪心][二分]
- ZOJ 3534 Move the Mouse I (ZOJ Monthly, September 2011 F题)
- zoj 3908 Number Game(zoj 2015年10月月赛F题)
- ZOJ-3207
- JSP
- js 验证码错误,输入框获得焦点并清除内容
- 第六周--数据结构之自建算法库之迷宫问题(用队列)
- erlang Emakefile
- unity 右键关闭
- ZOJ 3207 ( F)
- mysql免安装版如何使用
- Git学习笔记之二
- 一般的函数
- 杭电2092
- 4. 产品目录概念
- 处理 ActionBarDrawerToggle is Deprecated
- hbase 配置优化(2)
- ZOJ 3210 (I)