The first day?
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 90652 Accepted Submission (s): 34083
Problem Description
Given a date, the date of the output is the day ordinal of the year.
Input
There are several groups of input data, one row per group, the data format is YYYY/MM/DD, see sample input, and you can ensure that all input data is legal.
Output
For each set of input data, the output line indicates that the date is the day ordinal of the year.
Sample Input
1985/1/20
2006/3/12
Sample Output
20
71
Author
Lcy
Source
C Language Programming exercises (i)
#include <stdio.h>
int main ()
{
int y,m,d;
while (scanf ("%d%d%d", &y,&m,&d)!=eof)
{
if ((y%4==0&&y%100!=0) | | | (y%400==0))
{
Switch (m) {
Case 1:printf ("%d\n", D); Break
Case 2:printf ("%d\n", 31+d); Break
Case 3:printf ("%d\n", 60+d);
Case 4:printf ("%d\n", 91+d);
Case 5:printf ("%d\n", 121+d);
Case 6:printf ("%d\n", 152+d);
Case 7:printf ("%d\n", 182+d);
Case 8:printf ("%d\n", 213+d);
Case 9:printf ("%d\n", 243+d);
Case 10:printf ("%d\n", 273+d);
Case 11:printf ("%d\n", 304+d);
Case 12:printf ("%d\n", 334+d);
default:printf ("error\n");
}
}
else if ((y%4!=0&&y%100==0) | | | (y%400!=0))
{
Switch (m)
{
Case 1:printf ("%d\n", D); Break
Case 2:printf ("%d\n", 31+d); Break
Case 3:printf ("%d\n", 59+d);
Case 4:printf ("%d\n", 90+d);
Case 5:printf ("%d\n", 120+d);
Case 6:printf ("%d\n", 151+d);
Case 7:printf ("%d\n", 181+d);
Case 8:printf ("%d\n", 212+d);
Case 9:printf ("%d\n", 242+d);
Case 10:printf ("%d\n", 272+d);
Case 11:printf ("%d\n", 303+d);
Case 12:printf ("%d\n", 333+d);
default:printf ("error\n");
}
}
}
}
Day of the switch procedure Hangzhou Electric