• [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. JS基础 复习: Javascript的书写位置

    爱创课堂JS基础 复习: Javascript的书写位置复习 js书写位置:body标签的最底部.实际工作中使用书写在head标签内一对script标签里.alert()弹出框.console.log ...

  2. 阿里云centos配置postfix

    1. 为了防止垃圾邮件,先到域名控制面板设置好. MX A 记录及TXT记录 其中TXT记录如下  @  spf1 a mx ~all 意思就是使用spf1协议,允许a记录和MX记录对应的IP,不允许 ...

  3. linux mysql无故无法启动了,centos 7

    转自: http://support.moonpoint.com/software/database/mysql/not-running-centos7.php 下面简单翻译一下. 详细内容可以阅读英 ...

  4. 【深度学习笔记】(二)基于MNIST数据集的神经网络实验

    一.介绍 MNIST(Mixed National Institute of Standards and Technology database)是网上著名的公开数据库之一,是一个入门级的计算机视觉数 ...

  5. js基础01

    常见的五大浏览器:chrome firfox ie opera safari 浏览器的解析器会把代码解析成用户所能看到的东西 www.2cto.com/kf/201202/118111.html浏览器 ...

  6. bzoj1003

    考虑dp[i]表示前i天的最小总成本. 枚举上一次在第j天之后对路线进行了修改,那么就由dp[j]转移至dp[i],转移的代价是把第[j+1,i]天所有被占用的点全删掉后的最短路(不连通当然就是INF ...

  7. Redis全面介绍

    最近重新认识了一下Redis,借着这个机会,也整理一篇算是比较详尽和全面的文章吧.   缓存 缓存就是数据交换的缓冲区(称作Cache)——摘自百度百科.无论是在计算机硬件体系结构还是软件体系结构中, ...

  8. linux操作系统基础篇(四)

    一.系统监控 1.TOP 命令 1) top命令的功能:top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器. 2) 使用top命令列 ...

  9. ubuntu16.04安装交叉编译链

    我使用的是arm-linux-gcc 4.3.2版本,其他版本类似,附上下载链接: https://pan.baidu.com/s/1geUOfab 密码: frzy 首先我的安装包是tar.bz2的 ...

  10. .net core 使用X509 私钥加密请求

    1.获取证书路径 var basePath = _environment.ContentRootPath; //商户私钥证书,用于对请求报文进行签名 "); 2.数据加密 .net core ...