• [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的更多相关文章

  1. 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 ...

  2. NBUT 1457 莫队算法 离散化

    Sona Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Submit Status Practice NBUT 145 ...

  3. nyoj 218 Dinner(贪心专题)

    Dinner 时间限制:100 ms  |  内存限制:65535 KB 难度:1   描述 Little A is one member of ACM team. He had just won t ...

  4. ACM: NBUT 1107 盒子游戏 - 简单博弈

     NBUT 1107  盒子游戏 Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:  Practice  Appoint ...

  5. ACM: NBUT 1105 多连块拼图 - 水题 - 模拟

    NBUT 1105  多连块拼图 Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:  Practice  Appoint ...

  6. 借教室(codevs 1217)

    1217 借教室 2012年NOIP全国联赛提高组  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解  查看运行结果     题目描述 Descrip ...

  7. 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 ...

  8. ural 1217. Unlucky Tickets

    1217. Unlucky Tickets Time limit: 1.0 secondMemory limit: 64 MB Strange people live in Moscow! Each ...

  9. 【wikioi】1217 借教室

    题目链接http://www.wikioi.com/problem/1217/ 算法:二分答案(线段树可过wikioi数据) 二分:http://www.wikioi.com/solution/lis ...

随机推荐

  1. express的学习,与使用

    最近在学习vue的一个实战项目,碰到一个express,当时很萌,就随便看了看................ expres是基于node 的一个web框架, 首先可以找到它的官网照着学习 这里只讲一 ...

  2. CSS和文档

    1. 块级元素: p,div,ul,ol,h1,h2 . . . h6等.块级元素独占一行,旁边不能有其他元素. 2. 行内元素:span,a,strong,em等. display属性可以使块级元素 ...

  3. SharpGL(46)用Billboard绘制头顶文字

    CSharpGL(46)用Billboard绘制头顶文字 本文介绍CSharpGL用Billboard绘制头顶文字的方法.效果如下图所示. 下载 CSharpGL已在GitHub开源,欢迎对OpenG ...

  4. Visual Studio 2017开发环境的安装

    Visual Studio 2017是微软为了配合.NET战略推出的IDE开发环境,同时也是目前开发C#程序最新的工具,本节以Visual Studio 2017社区版的安装为例讲解具体的安装步骤. ...

  5. 【Win 10 应用开发】UI Composition 札记(六):动画

    动画在 XAML 中也有,而且基本上与 WPF 中的用法一样.不过,在 UWP 中,动画还有一种表现方式—— 通过 UI Composition 来创建. 基于 UI Composition 的动画, ...

  6. MySQL原理相关

    1.索引 http://blog.codinglabs.org/articles/theory-of-mysql-index.html

  7. Spring JDBC 示例

    在使用普通的 JDBC 数据库时,就会很麻烦的写不必要的代码来处理异常,打开和关闭数据库连接等.但 Spring JDBC 框架负责所有的低层细节,从开始打开连接,准备和执行 SQL 语句,处理异常, ...

  8. 基于BroadReceiver实现获取短信内容

    我朋友拜托我做一个能实现向指定号码发短信获取动态密码的一个小app,中间用到了基于监听系统通知的BroadReceiver 来实现获取有新短信并且获取新短信的内容.下面就是这个小app的实现监听部分的 ...

  9. web工程自动部署(tomcat服务器)

    工作中经常需要把web项目打成war包之后部署到tomcat服务器上,每次更新时步骤比较类似,这里提供公共步骤,编写名为auto_deploy.sh的shell脚本,只需要传递两个参数即可自动完成部署 ...

  10. JAVA基础面试(五)

    41.a.hashCode() 有什么用?与 a.equals(b) 有什么关系?        hashCode() 方法对应对象整型的 hash 值.它常用于基于 hash 的集合类,如 Hash ...