3.7牛客2021年度训练联盟热身训练赛第一场D.Some sum[思维]

链接:https://ac.nowcoder.com/acm/contest/12606/D
来源:牛客网
 

Your friend has secretly picked N consecutive positive 

integers between 1 and 100, and wants you to guess if their sum is

even or odd. 

If the sum must be even, output 'EvenEven'.  If the sum must be odd, output 'OddOdd'. If the sum could be even or could be odd, 

output 'EitherEither'.

输入描述:

The input is a single integer N with 1≤N≤101≤N≤10.

输出描述:

Output a single word. The word should be 'EvenEven', 'OddOdd', or 
'EitherEither', according to the rules given earlier.

示例1

输入

复制

1

输出

复制

Either

示例2

输入

复制

2

输出

复制

Odd
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n%2==1)
        cout<<"Either";
    else
    {
        if((n/2)%2==0)
            cout<<"Even";
        else 
            cout<<"Odd";
    }
    return 0;
}

 

上一篇:剑指offer_调整数组顺序使奇数位于偶数前面


下一篇:链表的奇偶重排