目录
题目描述
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;
}