# 哪一天，哪一秒？

小王特爱数字。期末复习各门功课烧脑厉害，他想换换脑筋，就想算算数。他想任意给出一个时间（年月日时分秒），得出是一年当中的第几天，还有，这是一年中的第几秒。

n行日期值，每行的整数分别代表年、月、日、时、分、秒，测试数据保证都是合法时间取值，即不会出类似2月30号的输入

n行输出，每行对应给出的时间是当年第几天，以及是当年第几秒

``````3
1971 1 8 14 25 48
2011 2 27 1 27 35
2012 11 2 11 23 1``````

``````8 743148
58 5016455
307 26565781``````

``````
#include <stdio.h>
struct Time
{
int year;
int month;
int day;
int hour;
int minute;
int second;
};
void getTime(struct Time *pt);
int dayOfYear(struct Time t);
long secondOfyear(struct Time *pt);
int main()
{
struct Time t;
int i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
getTime(&t);
printf("%d %ld\n",dayOfYear(t),secondOfyear(&t));
}
return 0;
}

void getTime(struct Time *pt)
{
scanf("%d%d%d%d%d%d", &pt->year, &pt->month, &pt->day, &pt->hour, &pt->minute, &pt->second);
return;
}
int dayOfYear(struct Time t)
{
int sum=0;
int i;
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
if((t.year%4==0&&t.year%100!=0)||(t.year%400==0))
a[2]=29;
for(i=1;i<=t.month-1;i++)
sum=sum+a[i];
sum=sum+t.day;
return sum;
}
long secondOfyear(struct Time *pt)
{
long sum;
sum=(dayOfYear(*pt))*24+pt->hour;
sum=sum*60+pt->minute;
sum=sum*60+pt->second;
return sum;
}``````

``````
#include <stdio.h>
struct Time
{
int year;
int month;
int day;
int hour;
int minute;
int second;
};
void getTime(struct Time *pt);
int dayOfYear(struct Time t);
long secondOfyear(struct Time *pt);
int main()
{
struct Time t;
int i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
getTime(&t);
printf("%d %ld\n",dayOfYear(t),secondOfyear(&t));
}
return 0;
}

void getTime(struct Time *pt)
{
scanf("%d%d%d%d%d%d", &pt->year, &pt->month, &pt->day, &pt->hour, &pt->minute, &pt->second);
return;
}
int dayOfYear(struct Time t)
{
int day=0,i,j;
int data[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
if((t.year%400==0)||(t.year%100!=0 && t.year%4==0))
data[1] = 29;
for(i=0;i<t.month-1;i++)
day+=data[i];
day+=t.day;
return day;
}
long secondOfyear(struct Time *pt)
{
long int second2=0;
second2+=(dayOfYear(*pt))*24*60*60;
second2+=((pt->hour))*60*60;
second2+=((pt->minute))*60;
second2+=(pt->second);
return second2;
}``````