Loading

【洛谷】闰年

题目描述

很简单,判断给定的年份是不是闰年。
但问题在于我一开始还真不知道闰年的定义..
image

#include<iostream>
using namespace std;

int main(){
	int year;
	cin>>year;
	if((year%4 == 0 && !(year%100 == 0)) || (year%400 == 0) ){
		cout<<1;
	}else{
		cout<<0;
	}
	return 0;
}

吭哧瘪肚交了好几次才过。。

posted @ 2024-03-01 22:12  SaTsuki26681534  阅读(27)  评论(0)    收藏  举报