2017.10.25
日期計(jì)算
時(shí)間限制:3000?ms ?|? 內(nèi)存限制:65535?KB 難度:1 描述#include <iostream>
#include <stdio.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv)
{
int N;
int year,month,day;
int sum=0;
int Month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
scanf("%d",&N);
for(int k=0;k<N;k++)
{
scanf("%d",&year);
scanf("%d",&month);
scanf("%d",&day);
if((year%4==0)&&(year%100!=0)||(year%400==0)) ? ?//閏年 能被4整除且不能被100整除或者能被400整除
{
Month[1]=29;
}
else
{
Month[1]=28;
}
for(int i=0;i<month-1;i++)
{
sum+=Month[i];
}
sum+=day;
printf("%d\n",sum);
sum=0;
}
return 0;
}
轉(zhuǎn)載于:https://www.cnblogs.com/panlangen/p/7730010.html
總結(jié)
以上是生活随笔為你收集整理的2017.10.25的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Sring AOP(简记)
- 下一篇: centos使用git安装nvm