NBUT 1217 Dinner
[1217] Dinner
- 时间限制: 1000 ms 内存限制: 32768 K
- 问题描写叙述
- 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 chopsticks
2 bowl letter- 例子输出
fork chopsticks
bowl- 提示
The tableware only contains: bowl, knife, fork and chopsticks.
- 来源
辽宁省赛2010
题目意思非常easy,就是输入n个字符串。当遇到bowl, knife, fork ,chopsticks.这四个字符串时就输出。所有在一行输出。每两个中间用一个空格隔开,最后不能有空格(我原以为没关系,所以在这里PE了一次…这就是教训啊…)。。
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long LL;
const int maxn= 100000 + 10;
char str[maxn];
char ss[4][20]= {"bowl","knife","fork","chopsticks"};
int main() {
int n;
while(~scanf("%d",&n)) {
bool flag=0;
for(int i=0; i<n; i++) {
scanf("%s",str);
for(int j=0; j<4; j++)
if(strcmp(str,ss[j])==0) {
if(flag)
printf(" %s",ss[j]);
else
{
printf("%s",ss[j]);flag=1;
}
break;
}
}
puts("");
}
return 0;
}
NBUT 1217 Dinner的更多相关文章
- NBUT 1217 Dinner 2010辽宁省赛
Time limit 1000 ms Memory limit 32768 kB Little A is one member of ACM team. He had just won the g ...
- NBUT 1457 莫队算法 离散化
Sona Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Submit Status Practice NBUT 145 ...
- nyoj 218 Dinner(贪心专题)
Dinner 时间限制:100 ms | 内存限制:65535 KB 难度:1 描述 Little A is one member of ACM team. He had just won t ...
- ACM: NBUT 1107 盒子游戏 - 简单博弈
NBUT 1107 盒子游戏 Time Limit:1000MS Memory Limit:65535KB 64bit IO Format: Practice Appoint ...
- ACM: NBUT 1105 多连块拼图 - 水题 - 模拟
NBUT 1105 多连块拼图 Time Limit:1000MS Memory Limit:65535KB 64bit IO Format: Practice Appoint ...
- 借教室(codevs 1217)
1217 借教室 2012年NOIP全国联赛提高组 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题解 查看运行结果 题目描述 Descrip ...
- ACM: NBUT 1646 Internet of Lights and Switches - 二进制+map+vector
NBUT 1646 Internet of Lights and Switches Time Limit:5000MS Memory Limit:65535KB 64bit IO Fo ...
- ural 1217. Unlucky Tickets
1217. Unlucky Tickets Time limit: 1.0 secondMemory limit: 64 MB Strange people live in Moscow! Each ...
- 【wikioi】1217 借教室
题目链接http://www.wikioi.com/problem/1217/ 算法:二分答案(线段树可过wikioi数据) 二分:http://www.wikioi.com/solution/lis ...
随机推荐
- java 中 final 的用法
/* final可以修饰类,方法,变量 特点: final可以修饰类,该类不能被继承. final可以修饰方法,该方法不能被重写.(覆盖,复写) final可以修饰变量,该变量不能被重新赋值.因为这个 ...
- flask中使用xlsxwriter导出excel文件
最近需要使用flask导出xlsxwriter生成的excel文件,在文件比较小的情况下,可以直接导出. 首先,这里使用了StringIO,导出使用的模块 import xlsxwriter impo ...
- 【Kafka源码】broker被选为controller之后的连锁反应
[TOC] 今天我们主要分析下broker被选为controller之后,主要干了什么.门面代码先列出来: def onControllerFailover() { if (isRunning) { ...
- PLSQL锁表之后改如何操作
(1)查看哪个表被锁select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects ...
- 【Kafka源码】处理请求
[TOC] 在KafkaServer中的入口在: apis = new KafkaApis(socketServer.requestChannel, replicaManager, groupCoor ...
- CocoaPods 安装及使用
1.开启 terminal 2.移除现有 Ruby 默认源 $ gem sources --remove https://rubygems.org/ 3.使用新的源 $ gem sources -a ...
- Unity3D 热更新方案(集合各位专家的汇总)
http://blog.csdn.net/guofeng526/article/details/52662994 热更新”这个词,在Unity3D的应用下,是有些语义错误的,但是作为大家都熟知的一项技 ...
- c#使用PortableDeviceApiLib读取便携式设备(WPD:Windows Portable Devices)信息
相关名词解释: WPD( Windows Portable Devices) 译作Windows 便携设备 (WPD) 是一种驱动程序技术,可支持广泛的可移动设备,比如移动电话.数码相机和便携媒体播放 ...
- Hangfire在ASP.NET CORE中的简单实现
hangfire是执行后台任务的利器,具体请看官网介绍:https://www.hangfire.io/ 新建一个asp.net core mvc 项目 引入nuget包 Hangfire.AspNe ...
- 在JQuery中如何获取当前时间?
////发表时间(now) function p(s) { return s < 10 ? '0' + s : s; } var myDate = new Date(); //获取当前年 var ...