hdu 5774 Where Amazing Happens(2016 Multi-University Training Contest 4——打表)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5774

Where Amazing Happens

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 443    Accepted Submission(s): 300

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

Author

FZU

Source

2016 Multi-University Training Contest 4

题目大意:判断题目中所给字符串出现的次数。

解题思路:写段代码处理一下题面,接下去就是暴力~~~~

详见代码。

#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<map>
const  double INF=0x3fffffff;

const  double eps=1e-10;
const double PI=acos(-1.0);

using namespace std;

int hah[1000]= {1,2,5,3,1,11,17,3,6,2,2,1,1,1,2,1,1,2,1,5,1,1};
char s[30][1000]= {{"Cleveland Cavaliers"}
    ,{"Golden State Warriors"}
    ,{"San Antonio Spurs"}
    ,{"Miami Heat"}
    ,{"Dallas Mavericks"}
    ,{"L.A. Lakers"}
    ,{"Boston Celtics"}
    ,{"Detroit Pistons"}
    ,{"Chicago Bulls"}
    ,{"Houston Rockets"}
    ,{"Philadelphia 76ers"}
    ,{"Seattle Sonics"}
    ,{"Washington Bullets"}
    ,{"Portland Trail Blazers"}
    ,{"New York Knicks"}
    ,{"Milwaukee Bucks"}
    ,{"St. Louis Hawks"}
    ,{"Philadelphia Warriors"}
    ,{"Syracuse Nats"}
    ,{"Minneapolis Lakers"}
    ,{"Rochester Royals"}
    ,{"Baltimore Bullets"}
};

int main()
{
    int t;
    int tt=1;
    scanf("%d",&t);
    getchar();
    while(t--)
    {
        char ch[1000];
        gets(ch);
        bool flag=false ;
        printf("Case #%d: ",tt++);
        for(int i=0; i<22; i++)
        {
            if(strcmp(ch,s[i])==0)
            {
                flag=true ;
                printf("%d\n",hah[i]);
                break;
            }
        }
        if(!flag) printf("0\n");
    }
    return 0;
}
时间: 2024-10-11 20:36:44

hdu 5774 Where Amazing Happens(2016 Multi-University Training Contest 4——打表)的相关文章

HDU 4906 Our happy ending(2014 Multi-University Training Contest 4)

题意:构造出n个数 这n个数取值范围0-L,这n个数中存在取一些数之和等于k,则这样称为一种方法.给定n,k,L,求方案数. 思路:装压 每位 第1为表示这种方案能不能构成1(1表示能0表示不能)  第2为表示能不能构成2 ...  这样用d[1<<n] 的DP  像背包那样背 n次就可以 最后状态中第k位为1的就可以加上方法数. #include<cstring> #include<cstdio> #include<cmath> #include <

HDU 4888 Redraw Beautiful Drawings(2014 Multi-University Training Contest 3)

题意:给定n*m个格子,每个格子能填0-k 的整数.然后给出每列之和和每行之和,问有没有解,有的话是不是唯一解,是唯一解输出方案. 思路:网络流,一共 n+m+2个点   源点 到行连流量为 所给的 当前行之和.    每行 连到每一列 一条流量为  k的边,每列到汇点连 列和.如果流量等于总和则有解,反之无解(如果列总和不等于行总和也无解).  判断方案是否唯一 找残留网络是否存在长度大于2的环即可,有环说明不唯一. #include<cstdio> #include<cstring&

【模拟】HDU 5774 Where Amazing Happens

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5774 题目大意: 已知1946~2015每一年赢得人是谁,给n个名字,问赢了多少次. 题目思路: [模拟] 打个表就好. 1 #include<stdio.h> 2 #include<string.h> 3 char list[100][35]= 4 {"Cleveland Cavaliers", 5 "Golden State Warriors&quo

HDU 5774 Where Amazing Happens

水题.比赛的时候用txt删了数字还有-,然后WA了...然后发现Philadelphia 76ers,这个队名中有数字...... #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #incl

hdu 6406 Taotao Picks Apples (2018 Multi-University Training Contest 8 1010)(二分,前缀和)

链接:http://acm.hdu.edu.cn/showproblem.php?pid=6406 思路: 暴力,预处理三个前缀和:[1,n]桃子会被摘掉,1到当前点的最大值,1到当前点被摘掉的桃子的数量,然后我们枚举修改p点造成的所有影响,: 1,假如新输入的点比原先的点的值更大,那么我们对修改后p这个点的值和[1,p-1]的最大值关系进行分析,也就是分析前半段的影响:(1)如果p点大于1-p-1的最大值的时候我们直接利用前缀和O(1)得到[1,p-1]有多少个桃子被摘掉,然后加上当前这个.(

hdu 6665 Calabash and Landlord (2019 Multi-University Training Contest 8 1009)(离散化)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6665 题目大意:给定四个点分别为两个矩形的左上角和右下角,两个矩形与坐标轴平行,问坐标平面(含负轴,但矩形只在第一象限内,部分边可能在正轴上)被两个矩形划分为几个区域(原意问的是几个连通点集但因为是实数点所以相当于问的是区域). 思路:如题,离散化.可以看到点坐标的值可能非常大,但是注意求的只是区域个数,而并不用求每个区域内点的个数,所以我们想要的信息只有点和点之间的位置关系,这时候最简单的方法,就

hdu 5775 Bubble Sort(2016 Multi-University Training Contest 4——树状数组)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5775 Bubble Sort Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 636    Accepted Submission(s): 378 Problem Description P is a permutation of the

hdu 5802 Windows 10(2016 Multi-University Training Contest 6——贪心+dfs)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5802 Windows 10 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1005    Accepted Submission(s): 333 Problem Description Long long ago, there was a

hdu 5792 World is Exploding(2016 Multi-University Training Contest 5——树状数组)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5792 World is Exploding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 643    Accepted Submission(s): 306 Problem Description Given a sequence A