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 ...
随机推荐
- 史上最全的IntelliJIdea快捷键
Ctrl+Shift+方向键Up/Down 代码向上/下移动. Ctrl+X 删除行 Ctrl+Y 也是删除行,不知道有啥区别 Ctrl+D 复制行 Ctrl+Alt+L 格式化代码 Ctrl+N 查 ...
- C#实现设置完整虚拟路径
){ mHttpUrl.Append(":"); mHttpUrl.Append(port);}string mServerName = "~/AppModu ...
- java输出各种学生成绩
class stu { public String stuno; public String name; public float math; public float english; public ...
- Web攻击技术
Web攻击技术 1.针对Web的攻击技术 1.1.在客户端即可篡改请求 在Web应用中,从浏览器那接收到的Http的全部内容,都可以在客户端自由地变更.篡改,所以Web应用可能会接收到与预期数据不相同 ...
- 【爬虫】利用Scrapy抓取京东商品、豆瓣电影、技术问题
1.scrapy基本了解 Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架.可以应用在包括数据挖掘, 信息处理或存储历史数据等一系列的程序中.其最初是为了页面抓取(更确切来说,网络抓 ...
- mybatis批量修改
使用mybats经常要用到批量修改或者删除,贴出批量修改的代码.如果是批量删除,可将update换成delete. <update id="changestatus" par ...
- Python环境变量搭建
1.首先下载相对应的Python版本,安装后在系统环境变量的path路径下加入安装的默认路径: 2.测试:dos命令下输入python.回车,然后测试,exit()退出来,测试完成.
- vue-router在ie9及以下history模式支持
参考: https://www.npmjs.com/package/vue-route https://github.com/devote/HTML5-History-API 提要: ie9及以下不支 ...
- Centos下mongodb的安装与配置
安装MongoDB的方法有很多种,可以源代码安装,在Centos也可以用yum源安装的方法. 1.准备工作 运行yum命令查看MongoDB的包信息 yum info mongodb-org (提示没 ...
- 使用ztree展示树形菜单结构
官网:http://www.treejs.cn/v3/main.php#_zTreeInfo 一.功能简介 在权限系统中,实现给角色指定菜单权限的功能.主要包括以下几点: 读取全部菜单项,并以树形结构 ...