您的位置:首页 > 其它

HDU 1491 Octorber 21st

2017-10-13 14:20 246 查看
http://acm.hdu.edu.cn/showproblem.php?pid=1491

 

Octorber 21st


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

Total Submission(s): 1234 Accepted Submission(s):
815


[align=left]Problem Description[/align]
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.



 

[align=left]Input[/align]
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(合法).

 

[align=left]Output[/align]
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!!".

 

[align=left]Sample Input[/align]

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

 

[align=left]Sample Output[/align]

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

 

[align=left]Author[/align]
8600

 

[align=left]Source[/align]

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

 

[align=left]Recommend[/align]
LL
 
分析:简单题,ac之。。
代码如下:

#include<stdio.h>

int main()

{

 int
biao[15]={0,31,28,31,30,31,30,31,31,30,31};

 int T;

 int i,month,day,ans;

 scanf("%d",&T);

 while(T--)

 {

  scanf("%d%d",&month,&day);

  ans=0;

  if((month==10&&day>21)||month>10)

   printf("What
a pity, it has passed!\n");

       
else if(month==10&&day==21)

   printf("It's
today!!\n");

       
else

       
{

   for(i=month;i<10;i++)

    ans+=biao[i];

   ans=ans+21-day;

   printf("%d\n",ans);

       
}

 }

 return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: