2011-12-12 03:48:21
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2005
题意:中文题。
代码:
# include <stdio.h>
# define LEAP(y) ((y)%4==0&&(y)%100!=0||(y)%400==0)
int main ()
{
int month[2][13] = {
{0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
{0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}} ;
int yy, mm, dd ;
while (~scanf ("%d/%d/%d", &yy, &mm, &dd))
printf ("%d\n", month[LEAP(yy)][mm]+dd) ;
return 0 ;
}