P5711 【深基3.例3】闰年判断 题解

有关三目运算符的总目录

三目运算符大法好

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#define ll long long
#define re register
#define p (a+b+c)/2
using namespace std;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int x;
int main()
{
    x=read();
    printf("%d",((x%4==0&&x%100!=0)||(x%400==0))?1:0);
}
原文地址:https://www.cnblogs.com/lbssxz/p/13121441.html