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:取得当前日期是一个星期中的第几天,注 ...
随机推荐
- Angular路由参数传递
一.路由时传递参数的方式 1.在查询参数中传递数据 //页面 <a routerLink="/product" [queryParams]="{id:1}" ...
- StrobeMediaPlayback的Javascript桥接
StrobeMediaPlayback是Adobe官方出的流媒体播放器,支持RTMP协议,在项目中运用到了,却在网上怎么都找不到相关资料,可以说是寥寥无几. 无奈之下,稍微看了点源代码,对播放器与JS ...
- Ubuntu学习笔记2-网络部分
Ubuntu server配置IP地址 第一种方法:常规方法 1.登录Ubuntu Server,然后通过“sudo -s” 切换到root用户. 2.输入“cd /etc/network/”,回车 ...
- python16_day14【jQuery】
一.作用域 1.作用域例一 <script> var str = "global"; //AO1 AO1.str function t(age){ console.lo ...
- beego——参数配置
beego目前支持INI.XML.JSON.YAML格式的配置文件解析,但是默认采用了INI格式解析,用户可以通过简单的配置就可以获得很大的灵活性. 一.默认配置解析 beego 默认会解析当前应用下 ...
- python中的闭包是什么
当一个嵌套函数在其外部区域引用了一个值时,该嵌套函数就是一个闭包,其意义就是会记录这个值 def A(x): def B(): print(x) return B A(7)() #7
- 113. Path Sum II(求等于某个数的所有路径)
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given su ...
- java注解1
http://computerdragon.blog.51cto.com/6235984/1210969 http://blog.csdn.net/it_man/article/details/440 ...
- MiniGUI 显示中文
修改/usr/local/etc/MiniGUI.cfg # The first system font must be a logical font using RBF device font.[s ...
- bug最后汇总-2018/08/03
一.对于点击后请求时间过长的按钮 现象:容易给用户点击无效的错觉,从而导致多次点击,从而发出多个相同请求,这显然是不符合我们意愿的 解决: 用户点击发出多个请求:加个锁,当用户点击后,将锁关闭,使用户 ...