Topic DescriptionTime flies, Riyuerusuo, the university is precious, to seize the time AC ^_^. Do you know that today is the first day of the year, pinch refers to a count or a long time, hehe or let the computer to do it. The problem here is that you write a program that enters a certain day of the year to determine which day is the first of the year.
inputThe input data has more than one group, the first row is the number of groups N, the following n rows is n group of data, each group of data consists of 3 positive integers, respectively, the year, month, day, we guarantee that each group of data is a valid date.
OutputThe date entered for the output is the day ordinal of the year.
Sample Input
2
2009 1 1
2008 1 3
Sample Output
1
3
#include <stdio.h>
int main ()
{
int T, y, M, D, no, I;
int p[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
scanf ("%d", &t);
while (t--) {
scanf ("%d%d%d", &y, &m, &d);
if (y%400==0 | | (y%4==0&&y%100!=0))
P[2] = 29;
Else
P[2] = 28;
No = 0;
for (I=1; i<m; i++)
no = P[i];
no + = D;
printf ("%d\n", no);
}
return 0;
}