一些数字可能拥有以下的性质:
- 性质 1:是偶数;
- 性质 2:大于 4 且不大于 12。
小A 喜欢这两个性质同时成立的数字;Uim 喜欢这至少符合其中一种性质的数字;八尾勇喜欢刚好有符合其中一个性质的数字;正妹喜欢不符合这两个性质的数字。
输入一个数字 x (0≤x≤1000)
输出这 4 个人是否喜欢这个数字,如果喜欢则输出1,否则输出0,用空格分隔。
输入 | 输出 |
---|---|
12 |
1 1 0 0 |
#include<iostream>
using namespace std;
int n;
int main()
{
cin>>n;
if(n%2==0 && n>4 && n<=12)
cout<<1;
else
cout<<0;
if(n%2==0 || (n>4 && n<=12))
cout<<" "<<1;
else
cout<<" "<<0;
if((n%2==0 && !(n>4 && n<=12)) || (!(n%2==0) && (n>4 && n<=12)))
cout<<" "<<1;
else
cout<<" "<<0;
if(!(n%2==0) && !(n>4 && n<=12))
cout<<" "<<1;
else
cout<<" "<<0;
return 0;
}
原文:https://www.cnblogs.com/codespark/p/14592831.html