0
点赞
收藏
分享

微信扫一扫

闰年*2020整理

想溜了的蜗牛 2022-03-25 阅读 39
c++
#include<iostream>
#include<stdio.h>
using namespace std;
//闰年 
bool judge(int year){
	if(year%100==0){
		if(year%400==0) return true;
		else return false;
	}else{
		if(year%4==0)return true;
		else return false;
		}
}
int main(){
	int T;cin>>T;
	int y,m,d;
    int days[12]={0,31,59,90,120,151,181,212,243,273,304,334};
    while(T--){
	scanf("%d:%d:%d",&y,&m,&d);
	if(judge(y)==true){
		if(m>2){
			cout<<days[m-1]+d+1<<endl;
		}else{
			cout<<days[m-1]+d<<endl;
		}
	}else{
		cout<<days[m-1]+d<<endl;
	}
}  
	return 0;	
}
举报

相关推荐

0 条评论