NBUT 1217 Dinner

  • [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;
    }
时间: 2024-07-29 00:03:29

NBUT 1217 Dinner的相关文章

HDOJ 1217 Floyed Template

1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <cstring> 5 #include<map> 6 using namespace std; 7 8 map<string,int>name; 9 const int INF = 1000000; 10 const int MAXSIZE = 1005; 11 const int

HDU 1217 Arbitrage 【最短路,map+spfa】

Arbitrage Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6985    Accepted Submission(s): 3212 Problem Description Arbitrage is the use of discrepancies in currency exchange rates to transform

ural 1217. Unlucky Tickets

1217. Unlucky Tickets Time limit: 1.0 secondMemory limit: 64 MB Strange people live in Moscow! Each time in the bus, getting a ticket with a 6-digit number, they try to sum up the first half of digits and the last half of digits. If these two sums ar

CSUOJ 1217 奇数个的那个数

Description 给定些数字,这些数中只有一个数出现了奇数次,找出这个数. Input 每组数据第一行n表示数字个数,1 <= n <= 2 ^ 18 且 n % 2 == 1. 接下来n行每行一个32位有符号整数. Output 出现奇数次那个数,每组数据对应一行. Sample Input 5 1 1 2 2 3 7 1 2 1 2 2 3 3 Sample Output 3 2 看了大神的代码 使用位运算o(╯□╰)o 1 # include <stdio.h> 2 i

codevs 1217 借教室

1217 借教室 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define maxn 1000000 4 #define inf 1<<30 5 6 int n,m,tot,num[maxn],q[maxn]; 7 int sta[maxn],d[maxn],end[maxn]; 8 9 bool check(int now) 10 { 11 tot=0; 12 for(int i=1;i<=n;i++) q[i]=

(BFS)HDU 4784 Dinner Coming Soon

Coach Pang loves his boyfriend Uncle Yang very much. Today is Uncle Yang's birthday, Coach Pang wants to have a romantic candlelit dinner at Uncle Yang's house and he has to arrive there in T minutes.  There are N houses in their city numbered from 1

HDU 1217 Arbitrage(Bellman-Ford判断负环+Floyd)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1217 题目大意:问你是否可以通过转换货币从中获利 如下面这组样例: USDollar 0.5 BritishPound BritishPound 10.0 FrenchFranc FrenchFranc 0.21 USDollar 可以通过US->Br->French->US这样转换,把1美元变成1*0.5*10*0.21=1.05美元赚取%5的利润. 解题思路:其实就相当于bellman-

网络流(最大流)CodeForces 512C:Fox And Dinner

Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old. They will have dinner around some round tables. You want to distribute foxes such that: Each fox is sitting at some table

ACM: NBUT 1105 多连块拼图 - 水题 - 模拟

NBUT 1105  多连块拼图 Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format: Practice Appoint description:  System Crawler  (Aug 12, 2016 9:32:14 AM) Description 多连块是指由多个等大正方形边与边连接而成的平面连通图形. -- 维基百科 给一个大多连块和小多连块,你的任务是判断大多连块是否可以由两个这样的小多连块拼成.小多连块只能