P5711 【深基3.例3】闰年判断
作者:互联网
设:
\(p: 4\mid x\)
\(q: 100\mid x\)
\(r: 400\mid x\)
易知答案为
\[p\and\neg(q\and\neg r) \]从而
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x;
scanf("%d", &x);
int p, q, r;
p = (x % 4 == 0);
q = (x % 100 == 0);
r = (x % 400 == 0);
printf("%d", p&&(!(q&&!r)));
return 0;
}
标签:闰年,int,neg,深基,mid,&&,400,100,P5711 来源: https://www.cnblogs.com/Cierra-Runis/p/15256423.html