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 ...
随机推荐
- MySQL数据库中文变问号
原文参考:http://www.linuxidc.com/Linux/2017-05/144068.htm 系统是的Ubuntu 16,修改以下配置 1.sudo vi /etc/mysql/my. ...
- 阿里云centos配置postfix
1. 为了防止垃圾邮件,先到域名控制面板设置好. MX A 记录及TXT记录 其中TXT记录如下 @ spf1 a mx ~all 意思就是使用spf1协议,允许a记录和MX记录对应的IP,不允许 ...
- localstorage本地定时缓存
在做一个网站时,起初直接就是从服务器获取数据进行交互,没有用一些本地缓存做优化,项目做下来就特别卡,并且对服务器造成了很大的压力,经过请教,查询,找到这样一个定时缓存的例子.html5定时缓存,从数据 ...
- JavaScript 数组基本操作
简介 数组操作无论是在JavaScript中还是在其他语言中都是很常见.经常会用到的,现在我把JavaScript 数组基本操作整理一下,供大家参考学习.里边包含我自己的见解以及案例,希望能够帮助大家 ...
- 插件lombok的介绍安装
Lombok插件 介绍一个不错的Eclipse插件Lombok 该插件对Log4j简化的代码,因为不大,所以jar包也存在呢! Lombox是Eclipse的一个插件,用来自动生成Java代码,减少手 ...
- django作业2
管理后台 1.登陆Form 2.Session (用装饰器实现) 3.装饰器 4.主机,主机组 添加(主机,主机组) 删除 修改 查询
- cmd+任务管理器解决端口被占用的问题
1.打开cmd命令行 2.输入命令netstat –ano,会显示所有被占用的端口号以及占用该端口的程序所对应的进程号. (local address下面是端口号,PID是占用端口的某程序的进程号) ...
- 【架构篇】OCP和依赖注入
描述 本篇文章主要讲解 : (1)OO设计OCP原则: (2)依赖注入引入 (3)依赖注入分析 (4)依赖注入种类 1 内容区 1.1 IOC背景 (1)Ralph E. Johnson &a ...
- 实验:企业级分布式存储应用与实战-mogilefs实现
实验:企业级分布式存储应用与实战-mogilefs实现 (1)安装mogilefs 1.创建一个存放安装mogilefs所需的软件包的目录 cd /app/ mkdir mogilefs cd mog ...
- 利用vertical-align:middle垂直居中
以前总是以为vertical-align与text-align是同样的道理,一个是垂直居中,一个是水平居中,结果在这里一点效果也没有.事实上vertical-align与text-align完全不一样 ...