• [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. postgis几何操作函数集

    管理操作函数 AddGeometryColumn - Adds a geometry column to an existing table of attributes. By default use ...

  2. java模拟登陆功能

    package test; import java.util.Scanner; public class Login { static Scanner sc=new Scanner(System.in ...

  3. Navi.Soft31.产品.登录器(永久免费)

    1系统简介 1.1功能简述 电商平台和传统店铺相比,确实方便不少,直接在网上下单,快递直接送货到家.这其中,做电商平台的童鞋表示压力很大,因为可能同时开很多店铺,每个店铺都要登录.查看订单量.发货拣货 ...

  4. C# 4.0 新特性dynamic、可选参数、命名参数等

    1.dynamic ExpandoObject熟悉js的朋友都知道js可以这么写 :   1 var t = new Object(); 2 t.Abc = ‘something’; 3 t.Valu ...

  5. 在foreach的判断条件里执行方法会有效率问题吗?

    楼猪平时一有空就有看别人代码的习惯,从许多优秀规范的代码中学习到了很多简约高效的写法和画龙点睛的思想精华.但是有的时候也会觉得某些写法很值得玩味.比如刚看到一段代码,在foreach的条件判断里加了一 ...

  6. jstree 获取选中节点的所有子子点

    //加载功能树 function initTree() { $.jstree.destroy(); $.ajax({ type: "Get", url: "/Depart ...

  7. 2017年当下最值得你关注的前端开发框架,不知道你就OUT了!

    近几年随着 jQuery.Ext 以及 CSS3 的发展,以 Bootstrap 为代表的前端开发框架如雨后春笋般挤入视野,可谓应接不暇. 在这篇分享中,我将总结2017年当下最值得你关注的前端开发框 ...

  8. [转载] 文件锁(Filelock)与锁定映射文件部分内容

    转载自http://jiangzhengjun.iteye.com/blog/517677 文件锁 JDK 1.4引入了文件加锁机制,允许我们同步访问一个共享文件,不过,竞争同一文件的两个线程有可能在 ...

  9. Cordic算法——verilog实现

    上两篇博文Cordic算法--圆周系统之旋转模式.Cordic算法--圆周系统之向量模式做了理论分析和实现,但是所用到的变量依然是浮点型,而cordic真正的用处是基于FPGA等只能处理定点的平台.只 ...

  10. Maven依赖分析

    背景 昨天帮一位同事排查了一个依赖冲突的问题.问题的现象就是在IntelliJ IDEA运行项目正常,但是打包(Maven assembly jar)之后传到服务器运行失败,报错:Caused by: ...