杭电5773之Where Amazing Happens

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

AC代码如下:

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

int main() {
    map <string , int >p;
    p["Cleveland Cavaliers"] = 1;
    p["Golden State Warriors"] = 2;
    p["San Antonio Spurs"] = 5;
    p["Miami Heat"] = 3;
    p["Dallas Mavericks"] = 1;
    p["L.A. Lakers"] = 11;
    p["Boston Celtics"] = 17;
    p["Detroit Pistons"] = 3;
    p["Chicago Bulls"] = 6;
    p["Houston Rockets"] = 2;
    p["Philadelphia 76ers"] = 2;
    p["Seattle Sonics"] = 1;
    p["Washington Bullets"] = 1;
    p["Portland Trail Blazers"] = 1;
    p["New York Knicks"] = 2;
    p["Milwaukee Bucks"] = 1;
    p["St. Louis Hawks"] = 1;
    p["Philadelphia Warriors"] = 2;
    p["Syracuse Nats"] = 1;
    p["Minneapolis Lakers"] = 5;
    p["Rochester Royals"] = 1;
    p["Baltimore Bullets"] = 1;
    //cout <<p["Cleveland Cavaliers"] << endl;
    int t;
    scanf("%d",&t);
    int f = 1, flag = 1;
    //getchar();
    while (t --) {
        if (flag)    getchar();
        flag = 0;
        char a[40];
        memset(a, 0, sizeof(a));
        gets(a);
        //cout << a << endl;
        printf("Case #%d: %d\n",f++,p[a]);
        //getchar();
    }
    return 0;
} 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值