有关三目运算符简介点这里;
三目运算符大法好
#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 %d %d %d",x%2==0&&x>4&&x<13?1:0,(x%2==0&&x>4&&x<13)||(x%2!=0&&x>4&&x<13)||(x%2==0&&(x<=4||x>=13))?1:0,(x%2!=0&&x>4&&x<13)||(x%2==0&&(x<4||x>12)),x%2!=0&&(x<=4||x>=13)?1:0); //一个一个对应着来的,慢慢看
}
完结。