Where Amazing Happens

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0

 

Problem Description
As the premier men's professional basketball league in the world, the National Basketball Association (NBA) has witnessed many superstars, legendary teams and precious friendships. 



Here is a list of every season’s champion from the league's inception in 1946 to 2015.

Season Champion
2015-16 Cleveland Cavaliers
2014-15 Golden State Warriors
2013-14 San Antonio Spurs
2012-13 Miami Heat
2011-12 Miami Heat
2010-11 Dallas Mavericks
2009-10 L.A. Lakers
2008-09 L.A. Lakers
2007-08 Boston Celtics
2006-07 San Antonio Spurs
2005-06 Miami Heat
2004-05 San Antonio Spurs
2003-04 Detroit Pistons
2002-03 San Antonio Spurs
2001-02 L.A. Lakers
2000-01 L.A. Lakers
1999-00 L.A. Lakers
1998-99 San Antonio Spurs
1997-98 Chicago Bulls
1996-97 Chicago Bulls
1995-96 Chicago Bulls
1994-95 Houston Rockets
1993-94 Houston Rockets
1992-93 Chicago Bulls
1991-92 Chicago Bulls
1990-91 Chicago Bulls
1989-90 Detroit Pistons
1988-89 Detroit Pistons
1987-88 L.A. Lakers
1986-87 L.A. Lakers
1985-86 Boston Celtics
1984-85 L.A. Lakers
1983-84 Boston Celtics
1982-83 Philadelphia 76ers
1981-82 L.A. Lakers
1980-81 Boston Celtics
1979-80 L.A. Lakers
1978-79 Seattle Sonics
1977-78 Washington Bullets
1976-77 Portland Trail Blazers
1975-76 Boston Celtics
1974-75 Golden State Warriors
1973-74 Boston Celtics
1972-73 New York Knicks
1971-72 L.A. Lakers
1970-71 Milwaukee Bucks
1969-70 New York Knicks
1968-69 Boston Celtics
1967-68 Boston Celtics
1966-67 Philadelphia 76ers
1965-66 Boston Celtics
1964-65 Boston Celtics
1963-64 Boston Celtics
1962-63 Boston Celtics
1961-62 Boston Celtics
1960-61 Boston Celtics
1959-60 Boston Celtics
1958-59 Boston Celtics
1957-58 St. Louis Hawks
1956-57 Boston Celtics
1955-56 Philadelphia Warriors
1954-55 Syracuse Nats
1953-54 Minneapolis Lakers
1952-53 Minneapolis Lakers
1951-52 Minneapolis Lakers
1950-51 Rochester Royals
1949-50 Minneapolis Lakers
1948-49 Minneapolis Lakers
1947-48 Baltimore Bullets
1946-47 Philadelphia Warriors

(quoted from http://www.nba.com/history/nba-season-recaps/)

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

 

题意:

给定这些年以来得过总冠军的队伍名称,求给你的队伍共取得了多少次冠军。

 

map水一发啊,注意输入的格式。

 

附AC代码:

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cmath>
 4 #include<map>
 5 using namespace std;
 6 
 7 int main(){
 8     int n;
 9     cin>>n;
10     map<string,int> m;
11     m["Cleveland Cavaliers"]+=1;
12     m["Golden State Warriors"]+=1;
13     m["San Antonio Spurs"]+=1;
14     m["Miami Heat"]+=1;
15     m["Miami Heat"]+=1;
16     m["Dallas Mavericks"]+=1;
17     m["L.A. Lakers"]+=1;
18     m["L.A. Lakers"]+=1;
19     m["Boston Celtics"]+=1;
20     m["San Antonio Spurs"]+=1;
21     m["Miami Heat"]+=1;
22     m["San Antonio Spurs"]+=1;
23     m["Detroit Pistons"]+=1;
24     m["San Antonio Spurs"]+=1;
25     m["L.A. Lakers"]+=1;
26     m["L.A. Lakers"]+=1;
27     m["L.A. Lakers"]+=1;
28     m["San Antonio Spurs"]+=1;
29     m["Chicago Bulls"]+=1;
30     m["Chicago Bulls"]+=1;
31     m["Chicago Bulls"]+=1;
32     m["Houston Rockets"]+=1;
33     m["Houston Rockets"]+=1;
34     m["Chicago Bulls"]+=1;
35     m["Chicago Bulls"]+=1;
36     m["Chicago Bulls"]+=1;
37     m["Detroit Pistons"]+=2;
38     m["L.A. Lakers"]+=1;
39     m["L.A. Lakers"]+=1;
40     m["Boston Celtics"]+=1;
41     m["L.A. Lakers"]+=1;
42     m["Boston Celtics"]+=1;
43     m["Philadelphia 76ers"]+=1;
44     m["L.A. Lakers"]+=1;
45     m["Boston Celtics"]+=1;
46     m["L.A. Lakers"]+=1;
47     m["Seattle Sonics"]+=1;
48     m["Washington Bullets"]+=1;
49     m["Portland Trail Blazers"]+=1;
50     m["Boston Celtics"]+=1;
51     m["Golden State Warriors"]+=1;
52     m["Boston Celtics"]+=1;
53     m["New York Knicks"]+=1;
54     m["L.A. Lakers"]+=1;
55     m["Milwaukee Bucks"]+=1;
56     m["New York Knicks"]+=1;
57     m["Boston Celtics"]+=1;
58     m["Boston Celtics"]+=1;
59     m["Philadelphia 76ers"]+=1;
60     m["Boston Celtics"]+=8;
61     m["St. Louis Hawks"]+=1;
62     m["Boston Celtics"]+=1;
63     m["Philadelphia Warriors"]+=1;
64     m["Syracuse Nats"]+=1;
65     m["Minneapolis Lakers"]+=3;
66     m["Rochester Royals"]+=1;
67     m["Minneapolis Lakers"]+=1;
68     m["Minneapolis Lakers"]+=1;
69     m["Baltimore Bullets"]+=1;
70     m["Philadelphia Warriors"]+=1;
71     
72     int k=1;
73     getchar();//!
74     for(int i=0;i<n;i++){char s[31];
75         gets(s);//!读入空格 
76         cout<<"Case #"<<k++<<": ";
77         cout<<m[s]<<endl;
78     }
79     return 0;
80 } 

 

string测了一发也可以:

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cmath>
 4 #include<map>
 5 using namespace std;
 6 
 7 int main(){
 8     int n;
 9     cin>>n;
10     map<string,int> m;
11     m["Cleveland Cavaliers"]+=1;
12     m["Golden State Warriors"]+=1;
13     m["San Antonio Spurs"]+=1;
14     m["Miami Heat"]+=1;
15     m["Miami Heat"]+=1;
16     m["Dallas Mavericks"]+=1;
17     m["L.A. Lakers"]+=1;
18     m["L.A. Lakers"]+=1;
19     m["Boston Celtics"]+=1;
20     m["San Antonio Spurs"]+=1;
21     m["Miami Heat"]+=1;
22     m["San Antonio Spurs"]+=1;
23     m["Detroit Pistons"]+=1;
24     m["San Antonio Spurs"]+=1;
25     m["L.A. Lakers"]+=1;
26     m["L.A. Lakers"]+=1;
27     m["L.A. Lakers"]+=1;
28     m["San Antonio Spurs"]+=1;
29     m["Chicago Bulls"]+=1;
30     m["Chicago Bulls"]+=1;
31     m["Chicago Bulls"]+=1;
32     m["Houston Rockets"]+=1;
33     m["Houston Rockets"]+=1;
34     m["Chicago Bulls"]+=1;
35     m["Chicago Bulls"]+=1;
36     m["Chicago Bulls"]+=1;
37     m["Detroit Pistons"]+=2;
38     m["L.A. Lakers"]+=1;
39     m["L.A. Lakers"]+=1;
40     m["Boston Celtics"]+=1;
41     m["L.A. Lakers"]+=1;
42     m["Boston Celtics"]+=1;
43     m["Philadelphia 76ers"]+=1;
44     m["L.A. Lakers"]+=1;
45     m["Boston Celtics"]+=1;
46     m["L.A. Lakers"]+=1;
47     m["Seattle Sonics"]+=1;
48     m["Washington Bullets"]+=1;
49     m["Portland Trail Blazers"]+=1;
50     m["Boston Celtics"]+=1;
51     m["Golden State Warriors"]+=1;
52     m["Boston Celtics"]+=1;
53     m["New York Knicks"]+=1;
54     m["L.A. Lakers"]+=1;
55     m["Milwaukee Bucks"]+=1;
56     m["New York Knicks"]+=1;
57     m["Boston Celtics"]+=1;
58     m["Boston Celtics"]+=1;
59     m["Philadelphia 76ers"]+=1;
60     m["Boston Celtics"]+=8;
61     m["St. Louis Hawks"]+=1;
62     m["Boston Celtics"]+=1;
63     m["Philadelphia Warriors"]+=1;
64     m["Syracuse Nats"]+=1;
65     m["Minneapolis Lakers"]+=3;
66     m["Rochester Royals"]+=1;
67     m["Minneapolis Lakers"]+=1;
68     m["Minneapolis Lakers"]+=1;
69     m["Baltimore Bullets"]+=1;
70     m["Philadelphia Warriors"]+=1;
71     
72     int k=1;
73     getchar();
74     for(int i=0;i<n;i++){string s;
75         getline(cin,s);
76         cout<<"Case #"<<k++<<": ";
77         cout<<m[s]<<endl;
78     }
79     return 0;
80 } 

 

posted @ 2016-07-28 16:35  Kiven#5197  阅读(361)  评论(0编辑  收藏  举报