hdu 1491 Octorber 21st(数学题)

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

Problem Description

HDU‘s 50th birthday, on Octorber 21st, is coming. What an exciting day!! As a student of HDU, I always want to know how many days are there between today and Octorber 21st.So, write a problem and tell me the answer.Of course, the date I give you is always in
2006.

Input

The input consists of T test cases. The number of T is given on the first line of the input file.Following T lines, which represent dates, one date per line. The format for a date is "month day" where month is a number between 1 (which indicates January) and
12 (which indicates December), day is a number between 1 and 31.All the date in the input are in 2006, you can assume that all the dates in the input are legal(合法).

Output

For each case, if the date is before Octorber 21st, you should print a number that between the date and Octorber 21st.If the day is beyond Octorber 21st, just print "What a pity, it has passed!".If the date is just Octorber 21st, print"It‘s today!!".

Sample Input

7
10 20
10 19
10  1
10 21
9   1
11 11
12 12

Sample Output

1
2
20
It‘s today!!
50
What a pity, it has passed!
What a pity, it has passed!

Author

8600

Source

“2006校园文化活动月”之“校庆杯”大学生程序设计竞赛暨杭州电子科技大学第四届大学生程序设计竞赛

代码如下:

#include <cstdio>
int mon(int x)
{
    if(x == 1)
        return 31;
    else if(x == 2)
        return 28;
    else if(x == 3)
        return 31;
    else if(x == 4)
        return 30;
    else if(x == 5)
        return 31;
    else if(x == 6)
        return 30;
    else if(x == 7)
        return 31;
    else if(x == 8)
        return 31;
    else if(x == 9)
        return 30;
}
int main()
{
    int t;
    int m, d;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d",&m,&d);
        if(m == 10 && d == 21)
        {
            printf("It's today!!\n");
            continue;
        }
        if(m>10 ||(m==10&&d>21))
        {
            printf("What a pity, it has passed!\n");
            continue;
        }
        int sum = 0;
        for(int i = m; i < 10; i++)
        {
            sum+=mon(i);
        }
        printf("%d\n",sum-d+21);
    }
    return 0;
}
时间: 2024-08-23 22:49:10

hdu 1491 Octorber 21st(数学题)的相关文章

杭电 HDU ACM 1491 Octorber 21st

Octorber 21st Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3430    Accepted Submission(s): 2108 Problem Description HDU's 50th birthday, on Octorber 21st, is coming. What an exciting day!! A

HDU1491 Octorber 21st【水题】

Octorber 21st Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3086    Accepted Submission(s): 1898 Problem Description HDU's 50th birthday, on Octorber 21st, is coming. What an exciting day!! A

HDU 1491 社交网络(最短路计数)

题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=1491 题意:给出一个联通的无向图,边有权值.定义I(v)如下,计算每个点的I值. 思路:(1)最简单的就是那个floyd了...g[i][j]记录最短路长度,f[i][j]记录个数,不多说了: (2)下面说说我自己想出来的算法..枚举s和t,计算每个点到s和t的最短路..然后建立最短路树..之后求s到t的最短路个数..然后枚举删掉某个点再求最短路个数,则差值即为通过删掉点的最短路数目.

hdu 3123 GCC(数学题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3123 GCC Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 3808    Accepted Submission(s): 1234 Problem Description The GNU Compiler Collection (u

[BestCoder Round #5] hdu 4956 Poor Hanamichi (数学题)

Poor Hanamichi Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 743    Accepted Submission(s): 275 Problem Description Hanamichi is taking part in a programming contest, and he is assigned to so

HDU 4989 Summary(数学题暴力)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4989 Problem Description Small W is playing a summary game. Firstly, He takes N numbers. Secondly he takes out every pair of them and add this two numbers, thus he can get N*(N - 1)/2 new numbers. Thirdl

hdu 4950 Monster(数学题,多校8)

题目链接:pid=4950http://acm.hdu.edu.cn/showproblem.php?pid=4950">http://acm.hdu.edu.cn/showproblem.php?pid=4950 Monster Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 220    Accepted Submission

HDU 1418 抱歉(数学题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1418 Problem Description 非常抱歉,本来兴冲冲地搞一场练习赛,由于我准备不足,出现很多数据的错误,现在这里换一个简单的题目: 前几天在网上查找ACM资料的时候,看到一个中学的奥数题目,就是不相交的曲线段分割平面的问题,我已经发到论坛,并且lxj 已经得到一个结论,这里就不 多讲了,下面有一个类似的并且更简单的问题: 如果平面上有n个点,并且每个点至少有2条曲线段和它相连,就是说,

HDU 5003 Osu!(数学题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5003 Problem Description Osu! is a famous music game that attracts a lot of people. In osu!, there is a performance scoring system, which evaluates your performance. Each song you have played will have a