BASIC-1 闰年判断
- 闰年条件
- 年份是400的倍数。
- 年份是4的倍数而不是100的倍数;
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
const int N=1e6+9;
const double PI=acos(-1);
#define line '\n'
#define gt getchar()
#define mid ((L+R)>>1)
int read(){int x=0,op=1;char c=gt;while(!isdigit(c)){if(c=='-')op=-1;c=gt;}while(isdigit(c))x=x*10+c-48,c=gt;return x*op;}
int main()
{
int n=read();
if(n%400==0||(n%4==0&&n%100!=0))cout<<"yes"<<line;
else cout<<"no"<<line;
return 0;
}

浙公网安备 33010602011771号