Where Amazing Happens
题意:
让你输出各个队名的出现次数。
题解:
打表题,好坑,相同的没有放在一起,需要认真找,否则容易错。
代码:
#include<iostream>
#include<cstdio>
#include<map>
#include<cstring>
#include<string>
using namespace std;
map<string,int>a;
int main()
{
a["Baltimore Bullets"]=1 ;
a["Boston Celtics"]=17 ;
a["Chicago Bulls"]= 6;
a["Cleveland Cavaliers"]=1 ;
a["Dallas Mavericks"]=1 ;
a["Detroit Pistons"]=3 ;
a["Golden State Warriors"]= 2;
a["Houston Rockets"]= 2;
a["L.A. Lakers"]= 11;
a["Miami Heat"]= 3;
a["Milwaukee Bucks"]=1 ;
a["Minneapolis Lakers"]=5;
a["New York Knicks"]=2 ;
a["Philadelphia 76ers"]=2 ;
a["Philadelphia Warriors"]=2 ;
a["Portland Trail Blazers"]= 1;
a["Rochester Royals"]= 1;
a["San Antonio Spurs"]=5 ;
a["Seattle Sonics"]= 1;
a["St. Louis Hawks"]= 1;
a["Syracuse Nats"]=1 ;
a["Washington Bullets"]=1;
string s;
int kk=1;
int o;
cin>>o;
getchar();
while(o--)
{
getline(cin,s);
cout<<"Case #"<<kk<<": "<<a[s]<<endl;
kk++;
}
}