Advertisement

数的性质

阅读量:

题目描述

题目描述:
一些数字可能拥有以下的性质:
性质 1:是偶数;
性质 2:大于 4 且不大于 12。
小A 喜欢这两个性质同时成立的数字;Uim 喜欢这至少符合其中一种性质的数字;八尾勇喜欢刚好有符合其中一个性质的数字;正妹喜欢不符合这两个性质的数字。

输入描述
一行,一个整数。(0<=n<=1000)

输出描述:
输出这 4 个人是否喜欢这个数字,如果喜欢则输出1,否则输出0,用空格分隔。

输入样例:12
输出样例:1 1 0 0

复制代码
    #include<bits/stdc++.h>
    using namespace std;
    int a,b;
    int main()
    {
    	cin>>a;
    	if(a>4&&a<=12)
    		b++;
    	if(a%2==0)
    		b++;
    	if(b==2)
    		cout<<1<<' ';
    	else
    		cout<<0<<' ';
    	if(b>=1)
    		cout<<1<<' ';
    	else
    		cout<<0<<' ';
    	if(b==1)
    		cout<<1<<' ';
    	else
    		cout<<0<<' ';
    	if(b==0)
    		cout<<1;
    	else
    		cout<<0;
    	return 0;
    }
    
    
    
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
    

全部评论 (0)

还没有任何评论哟~