ZOJ 3207 80ers' Memory(strcmp函数的用法)
80ers' Memory
Time Limit: 1 Second Memory Limit: 32768 KB
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
4
Saint_Seiya
YoYo_ball
Super_Mario
HuLuWa
3
2 Saint_Seiya TiaoFangZi
1 KTV
3 HuLuWa YOYO_BALL YoYo_ball
Sample Output
1
0
2
Author: GAO, Fei
Source: The 6th Zhejiang Provincial Collegiate Programming Contest
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char str[][];
int n,k;
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
scanf("%s",&str[i]);
scanf("%d",&k);
for(int i=;i<=k;i++)
{
int x,ans=;
scanf("%d",&x);
for(;x>;x--)
{
char ch[];
scanf("%s",&ch);
for(int j=;j<=n;j++)
if (!strcmp(ch,str[j])) {ans++; break;}
}
printf("%d\n",ans);
}
return ;
}
ZOJ 3207 80ers' Memory(strcmp函数的用法)的更多相关文章
- 关于strcmp函数的用法
strcmp函数是在string.h库下的han函数, 具体用法如下: strcmp函数是用来比较2个字符串的函数,如srcmp(字如果符串1,字符串2),从第一个字符开始比较,如果到最后两个字符串完 ...
- strcmp函数和memcmp函数的用法区别及联系
前言: C语言中有很多东西容易搞混,最近笔者就遇到了一个问题.这里做个记录.就是memcmp和strcmp两者的用法,这里做个对比: 功能对比: A memcmp: 函数原型: int memcmp( ...
- ZOJ 80ers' Memory
80ers' Memory Time Limit: 1 Second Memory Limit: 32768 KB I guess most of us are so called 80er ...
- The 6th Zhejiang Provincial Collegiate Programming Contest->ProblemF:80ers' Memory
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3207 题意:给出N个关键字符串,然后给出k行,每行Ni个字符串,找出每行有 ...
- qsort函数的用法
qsort函数的用法 qsort 功 能: 使用快速排序例程进行排序 用 法: void qsort(void *base, int nelem, int width, int (*fcmp)( ...
- C语言 · 实现strcmp函数 · 字符串比较
蓝桥杯练习场上碰到两个此类题了: 算法提高 11-1实现strcmp函数 时间限制:1.0s 内存限制:256.0MB 问题描述 自己实现一个比较字符串大小的函数,也即实现strcm ...
- tensorflow.nn.bidirectional_dynamic_rnn()函数的用法
在分析Attention-over-attention源码过程中,对于tensorflow.nn.bidirectional_dynamic_rnn()函数的总结: 首先来看一下,函数: def bi ...
- C/C++ sort函数的用法
sort函数的用法(#include<algorithm>) 做ACM题的时候,排序是一种经常要用到的操作.如果每次都自己写个冒泡之类的O(n^2)排序,不但程序容易超时,而且浪费宝贵的比 ...
- 有关日期的函数操作用法总结,to_date(),trunc(),add_months();
相关知识链接: Oracle trunc()函数的用法 oracle add_months函数 Oracle日期格式转换,tochar(),todate() №2:取得当前日期是一个星期中的第几天,注 ...
随机推荐
- 基本数据类型补充、set集合、深浅拷贝
一.基本数据类型补充 1,关于int和str在之前的学习中已经介绍了80%以上了,现在再补充一个字符串的基本操作 str.join(可迭代对象): li = ['李嘉诚','何炅','海峰','刘嘉玲 ...
- Erlang正则解析操作文件
-module(tool). %% ==================================================================== %% API functi ...
- tf.clip_by_value:将tensor中的0和NONE进行范围限制的函数
tf.clip_by_value clip_by_value( t, clip_value_min, clip_value_max, name=None) Defined in ...
- 在Centos上打Preempt-rt实时补丁(续)
经过上一篇,发现2.6.31版本的补丁不能正常运行(还未找到原因),现改用2.6.33版本: kernel:linux-2.6.33.9 patch:patch-2.6.33.9-rt 解压并打好补丁 ...
- python的初识
解释型语言 和编译型语言 计算机本身不能识别高级语言,当我们运行一个程序的时候,需要一个“翻译” 来把 高级语言转换成计算机能读懂的语言. “翻译”过程分两种: 编译 编译型语言在执行程序前,首先会通 ...
- .net截取字符串
string s=abcdeabcdeabcdestring[] sArray1=s.Split(new char[3]{c,d,e}) ;foreach(string i in sArray1)Co ...
- iOS消息推送原理
推送相关概念,如下图1-1: 1.Provider:就是为指定IOS设备应用程序提供Push的服务器,(如果IOS设备的应用程序是客户端的话,那么Provider可以理解为服务端[消息的发起者]): ...
- Scala:scala的一些简单操作命令
Scala是一门多范式的编程语言,一种类似java的编程语言,设计初衷是实现可伸缩的语言.并集成面向对象编程和函数式编程的各种特性. 不太久之前编程语言还可以毫无疑意地归类成“命令式”或者“函数式”或 ...
- 深入理解MR1与MR2的执行流程
摘自:Tom White ,<Hadoop.The.Definitive.Guide.3rd.Edition> MR1 MR2
- windows系统下载地址大全&大白菜下载和教程
win10的 Windows10 64位纯净系统下载(不建议,后面的有原版) http://cjxt.sysdaa.com/down.php?post=win10-64&action=bend ...