nyoj-Dinner
来源:互联网 发布:银行卡网络异地消费 编辑:程序博客网 时间:2024/05/13 22:44
Dinner
时间限制:100 ms | 内存限制:65535 KB
难度:1
- 描述
- Little A is one member of ACM team. He had just won the gold in World Final. To celebrate, he decided to invite all to have one meal. As bowl, knife and other tableware is not enough in the kitchen, Little A goes to take backup tableware in warehouse. There are many boxes in warehouse, one box contains only one thing, and each box is marked by the name of things inside it. For example, if "basketball" is written on the box, which means the box contains only basketball. With these marks, Little A wants to find out the tableware easily. So, the problem for you is to help him, find out all the tableware from all boxes in the warehouse.
- 输入
- There are many test cases. Each case contains one line, and one integer N at the first, N indicates that there are N boxes in the warehouse. Then N strings follow, each string is one name written on the box.
- 输出
- For each test of the input, output all the name of tableware.
- 样例输入
3 basketball fork chopsticks2 bowl letter
- 样例输出
fork chopsticksbowl
- 提示
The tableware only contains: bowl, knife, fork and chopsticks.
思路分析:
用strcmp()函数进行字符串的比较。
参考代码:
#include<stdio.h>#include<stdlib.h>#include<string.h>using namespace std;char str[1000];int main(){int n;while(~scanf("%d",&n)){int i;for(i=0;i<n;i++){scanf("%s",str);if(strcmp(str,"bowl")==0||strcmp(str,"knife")==0||strcmp(str,"fork")==0||strcmp(str,"chopsticks")==0){printf("%s ",str);}}printf("\n");}return 0;}
0 0
- NYOJ--Dinner
- NYOJ Dinner
- nyoj-Dinner
- NYOJ 218题 Dinner
- nyoj-218-Dinner
- Dinner nyoj 水题
- NYOJ 218 Dinner
- nyoj 218 dinner
- nyoj-218-Dinner
- NYOJ 218 Dinner
- NYOJ 218 Dinner
- NYOJ 218 Dinner
- NYOJ 218 Dinner
- nyoj 218 Dinner
- nyoj 218Dinner<水>
- NYOJ 218 Dinner
- NYOJ 218 Dinner
- nyoj-218-Dinner
- MQ与Webservice的区别
- 在Android当中常用的控件的详解和分析
- Android 上下文Context(最权威的官方教程)
- php 通过stomp协议连接ActiveMQ
- mysql or和in还有like的简单使用
- nyoj-Dinner
- 小胖威利症 哈尔滨男孩李航286斤 一不小心重名了
- Git记录
- linux下gdb调试应用程序
- hdu-2089 不要62【数位dp】
- WPF GridControl 数据绑定
- Android中关于布局填充器的各种详细用法和说明
- 关于switch语句-四则运算(c++)
- Hibernate的Session详解(transaction)