BASIC-1 闰年判断

  • 闰年条件
  1. 年份是400的倍数。
  2. 年份是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;
}
posted @ 2020-04-15 16:20  啥也不是*  阅读(158)  评论(0)    收藏  举报