【题解】HDU 5774 Where Amazing Happens

目录

题目描述

题意分析

AC代码

                                                                                                             

题目描述

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

 

Given the team name, it won’t be difficult for you to count how many times this team(with exactly the same name) has made amazing happen.

Input

The first line gives the number of test cases. Each case contains one string S representing the team to be queried.
T<=30.S consists of English letters, digits, punctuations and spaces. And 1<=length(S)<=30.

Output

For each test case, output one line containing "Case #x: y", where x is the test case number (starting from 1) and y is the times this team has won the championship according to the list above.

Sample Input

2

Cleveland Cavaliers

Oklahoma City Thunder

Sample Output

Case #1: 1

Case #2: 0

题意分析

题意:给出一连串的队伍,然后给你T个队伍名,输出他们获了多少次奖。

           STL MAP solve it

 

AC代码

#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
using namespace std;

map <string ,int> s;

int main()
{
    s["Cleveland Cavaliers"]=1;
    s["Golden State Warriors"]=2;
    s["San Antonio Spurs"]=5;
    s["Miami Heat"]=3;
    s["Dallas Mavericks"]=1;
    s["L.A. Lakers"]=11;
    s["Boston Celtics"]=17;
    s["Detroit Pistons"]=3;
    s["Chicago Bulls"]=6;
    s["Houston Rockets"]=2;
    s["Philadelphia 76ers"]=2;
    s["Seattle Sonics"]=1;
    s["Washington Bullets"]=1;
    s["Portland Trail Blazers"]=1;
    s["New York Knicks"]=2;
    s["Milwaukee Bucks"]=1;
    s["St. Louis Hawks"]=1;
    s["Philadelphia Warriors"]=2;
    s["Syracuse Nats"]=1;
    s["Minneapolis Lakers"]=5;
    s["Rochester Royals"]=1;
    s["Baltimore Bullets"]=1;

    int t,i;
    string R;
    cin>>t;
    getchar();
    for(i=1;i<=t;i++)
    {
        getline(cin,R);
        printf("Case #%d: %d\n",i,s[R]);
    }

    return 0;
}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值