zoukankan      html  css  js  c++  java
  • 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 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.

    Input

    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.

    Output

    For each test of the input, output all the name of tableware.

    Sample Input

    3 basketball fork chopsticks
    2 bowl letter

    Sample Output

    fork chopsticks
    bowl

    Hint

    The tableware only contains: bowl, knife, fork and chopsticks.


    签到题
     1 #include<cstdio>
     2 #include<iostream>
     3 #include<string>
     4 #include<cstring>
     5 #include<algorithm>
     6 using namespace std;
     7 
     8 int main()
     9 {
    10     int n;
    11     char a[55];
    12     bool flag;
    13     while(~scanf("%d",&n))
    14     {
    15         flag=false;
    16         while(n--)
    17         {
    18             cin>>a;
    19             if(strcmp(a,"bowl")==0||strcmp(a,"knife")==0||strcmp(a,"fork")==0||strcmp(a,"chopsticks")==0)
    20             {
    21                 if(flag)
    22                     printf(" ");
    23                 cout<<a;
    24                 flag=true;
    25             }
    26         }
    27         cout<<endl;
    28     }
    29     return 0;
    30 }
  • 相关阅读:
    C# 文件压缩与解压(ZIP格式)
    sqlite 报 no such table 错误
    又一次的轮回
    什么是数据结构
    紧张繁忙的一周
    《编程匠艺》读书笔记之十九
    [转]软件开发者面试百问
    关于学习设计模式的一些废话
    雷人的山寨版搜索引擎
    [转]Struts 2.1发布
  • 原文地址:https://www.cnblogs.com/Annetree/p/6641285.html
Copyright © 2011-2022 走看看