YCCE03 - Editorial

PROBLEM LINKS

Practice

Contest

Author:SRIKANT BADRI

DIFFICULTY:

CAKEWALK

PROBLEM:

Given a list of integers. We are asked to report whether the number of even integers is more than the number of odd integers or not.

EXPLANATION:


This is a simple problem and can be solved by simply counting the number of even/odd integers.

Basic C++ Code:

int main() {
    int n; cin >> n;
    int cnt = 0;
    for(int i=1; i<=n; i++) {
        int x; cin >> x;
        if( x % 2 == 0 ) cnt ++;
    }
    puts( cnt > n - cnt ? "READY FOR BATTLE" : "NOT READY" );
    return 0;
}

SAMPLE SOLUTION:

Author