1007

来源:互联网 发布:软件设计师科目 编辑:程序博客网 时间:2024/05/17 22:31

Problem G

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 9   Accepted Submission(s) : 3

Font: Times New Roman | Verdana | Georgia

Font Size: ← →

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

710 2010 1910  110 219   111 1112 12

Sample Output

1220It's today!!50What a pity, it has passed!What a pity, it has passed!

水题  统计天数


代码


#include<iostream>
using namespace std;
int main()
{
    int t;
    int n,m;
    int j,k,l;
    int a[10]={0,31,28,31,30,31,30,31,31,30};
    int sum;
    cin>>t;
    while(t--&&cin>>n>>m)
    {
        if(n!=10) sum=a[n]-m+21;
        else sum=21-m;
        if(n>10)
        {cout<<"What a pity, it has passed!"<<endl;
        continue;}
        if(n==10&&m>21)
        {
            cout<<"What a pity, it has passed!"<<endl;
            continue;
        }
        if(n==10&&m==21)
        {
            cout<<"It's today!!"<<endl;
            continue;
        }
        for(j=n+1;j<10;j++)
        {
            sum+=a[j];
        }
        cout<<sum<<endl;
    }
}

0 0
原创粉丝点击