【洛谷】闰年
题目描述
很简单,判断给定的年份是不是闰年。
但问题在于我一开始还真不知道闰年的定义..

#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;
}
吭哧瘪肚交了好几次才过。。

浙公网安备 33010602011771号