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 }
  • 相关阅读:
    厦门航空牵手阿里云打造航空业移动研发中台,研发效率提升50%
    可能是国内第一篇全面解读 Java 现状及趋势的文章
    这样才能正确解锁MaxCompute客户端
    MaxCompute问答整理之10月
    tensorflow入门
    buctoj——合法的出栈顺序
    nyoj299——如何优雅的写矩阵快速幂
    nyoj164——卡特兰数(待填坑)
    nyoj139——康托展开
    字符串练习
  • 原文地址:https://www.cnblogs.com/Annetree/p/6641285.html
Copyright © 2011-2022 走看看