【題解】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;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章