HDU 1491 Octorber 21st
2017-10-13 14:20
246 查看
http://acm.hdu.edu.cn/showproblem.php?pid=1491
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;
}
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;
}
相关文章推荐
- HDU 1491 Octorber 21st (日期计算)
- HDOJ(HDU) 1491 Octorber 21st
- hdu 1491 Octorber 21st
- HDOJ(HDU) 1491 Octorber 21st
- HDU 1491 Octorber 21st
- HDU 1491 Octorber 21st
- hdu 1491(Octorber 21st)(模拟水题)
- HDU 1491 Octorber 21st
- HDU 1491 Octorber 21st
- hdu 1491 Octorber 21st
- hdu-oj 1491 Octorber 21st
- hdu 1491 Octorber 21st(数学题)
- HDU 1491 Octorber 21st
- HDU-1394&nbsp;Minimum&nbsp;Inversion&nbsp;Numbe…
- hdu 1427 速算24点
- HDU 2131 Probability
- HDU 1862 EXCEL排序
- HDU 1283 最简单的计算机
- 拓扑排序 hdu 2647 Reward
- hdu 1086