1052: Dinner

1052: Dinner

Time Limit: 1 Sec  Memory Limit:
32 MB
Submit: 50  Solved: 9
[Submit][Status][Web Board]

Description

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 chopsticks2 bowl letter

Sample Output

fork chopsticksbowl

HINT

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

#include <iostream>

#include <string>

 

using
namespace
std;

 

bool
IsEqual(string tmp)

{

    return
(tmp == "bowl"
|| tmp ==
"fork" || tmp ==
"chopsticks" || tmp ==
"knife");

}

int
main()

{

    int
num, k, count;

    string tmp;

 

    while
(cin >> num)

    {

        k = 0;

        count = 0;

        while
(count < num)

        {

            cin >> tmp;

            if
(IsEqual(tmp))

            {

                if
(k != 0)

                {

                    cout <<
" ";

                }

                cout << tmp;

                k ++;

            }

            count ++;

        }

       // if (k != 0)//如果没有匹配到任何一个,就不输出回车

        cout << endl;

    }

    return
0;

}

 

/**************************************************************

    Problem: 1052

    User: 1006440533

    Language: C++

    Result: Accepted

    Time:0 ms

    Memory:1272 kb

****************************************************************/

时间: 2024-08-23 04:47:47

1052: Dinner的相关文章

mingw-minGW+eclipse报错,编译的时候错在limits文件1052行,求大牛解决

问题描述 minGW+eclipse报错,编译的时候错在limits文件1052行,求大牛解决 g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "srcDD.o" "..srcDD.cpp" D:IDEeclipse-SDK-4.4.1-win32-x86_64MinGW/include/c++/3.4.5/limits:1052:9: error: a call to a constructor cannot appear i

C语言OJ项目参考(1052)两个字符串连接

1052: 两个字符串连接 Description 写一函数,将两个字符串连接 Input 两行字符串 Output 链接后的字符串 Sample Input** 123 abc Sample Output 123abc 参考解答: 函数版参考1: #include<stdio.h> void stringcat(char *s1, char *s2, char *s); int main() { char str1[100],str2[100],str3[100]; gets(str1);

Android ApiDemos示例解析(26):App-&amp;gt;Notification-&amp;gt;IncomingMessage

应用程序可以使用Notifications来通知用户某个事件发生了(如收到短信).类NotificationManager 用来处理 Notification, NotificationManager可以: 在Status Bar上显示一个新的图标. 在Extended status bar 窗口上显示附加信息或是启动一个Activity. 显示背光/LED. 使设备震动. 发出声音等. 对于一些没有UI的应用程序组件(如Broadcast Receiver, Services)或是非活动状态的

修改build-gnuradio免翻墙免炖github本地安装

1.将VMWare镜像中的~/sdr/ 复制到你的linux中 2.将以下文本替换掉build-gnuradio里的内容,没错 echo 'simpower91 modified here' echo 'Do you want to skip downloading from the internet?[yes]' read simskip if [ "$simskip"a = 'no'a ] then gitfetch fi echo 'simpower91 modified end

SQL Server错误代码及解释(一)

0 操作成功完成.  1 功能错误.  2 系统找不到指定的文件.  3 系统找不到指定的路径.  4 系统无法打开文件.  5 拒绝访问.  6 句柄无效.  7 存储控制块被损坏.  8 存储空间不足,无法处理此命令.  9 存储控制块地址无效.  10 环境错误.  11 试图加载格式错误的程序.  12 访问码无效.  13 数据无效.  14 存储器不足,无法完成此操作.  15 系统找不到指定的驱动器.  16 无法删除目录.  17 系统无法将文件移到不同的驱动器.  18 没有更

MonetDB bulk load performance &amp; fixed length type performance &amp; JOIN performance

之前写过一篇关于PostgreSQL使用UUID作为PK, 造成写入性能很差的分析文章, 有兴趣的童鞋可参考如下 :  http://blog.163.com/digoal@126/blog/static/16387704020129249646421/ 本文主要测试一下几个因素对导入速度的影响. 1. 索引列无序导入 2. 索引列顺序导入 3. 无索引无序导入(指某列无序) 4. 无索引顺序导入(指某列顺序) 测试数据使用的是前面一篇BLOG的测试数据, 60个字段, 第一个字段是INT, 主

Greys Java在线问题诊断工具

线上系统为何经常出错?数据库为何屡遭黑手?业务调用为何频频失败?连环异常堆栈案,究竟是那次调用所为? 数百台服务器意外雪崩背后又隐藏着什么?是软件的扭曲还是硬件的沦丧? 走进科学带你了解Greys, Java线上问题诊断工具. Greys的诞生 很早的时候,我们使用BTrace排查问题,在感叹BTrace的强大之余,也曾好几次将线上系统折腾挂掉.2012年淘宝的聚石写了HouseMD,将常用的几个Btrace脚本整合在一起形成一个独立风格的应用,但其核心代码用的是Scala,我们没这方面的编程维

android中解析text文件

问题描述 android中解析text文件 在应用中,创建了一个text文件保存数据,值大致如下: 98, 97, 98, ...... 需要从text文件中获取然后保存在一个数组列表中,想实现时报出异常. 代码: package com.example.meme; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import ja

线上性能问题初步排查方法

本文首发于并发网,作者:方腾飞 引言 有时候有很多问题只有在线上或者预发环境才能发现,而线上又不能Debug,所以线上问题定位就只能看日志,系统状态和Dump线程,本文只是简单的介绍一些常用的工具,帮助定位线上问题. 问题定位 1: 首先使用TOP命令查看每个进程的情况,显示如下: top - 22:27:25 up 463 days, 12:46, 1 user, load average: 11.80, 12.19, 11.79 Tasks: 113 total, 5 running, 10