Even Sum Versus Odd Sum
InterviewTime limit1sMemory limit128 MB
For each of up to 50 sequences, add the even numbers and the odd numbers separately and print EVEN, ODD, or TIE based on which sum is larger.
- Level
Easy1 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
When new programs arrive in the grid world, they begin by playing the simplest games in the Disc Arena against other novice programs. One of those games is played in front of a large board as follows: a sequence of numbers appears on the board, and the players must decide whether the sum of the even numbers in the sequence is larger than the sum of the odd numbers, whether the sum of the odd numbers is larger, or whether the two sums are equal. The first player to give the correct answer wins, and the losers are deleted.
For example, for the sequence 5, 7, 2, 1, 10, 13, 6, 12 the sum of the even numbers is , while the sum of the odd numbers is , so the correct answer is "EVEN".
Help Sam, our protagonist, win this game so he can survive and keep searching for his father.
Input
The first line contains the number of test cases (). Each of the following lines contains one test case. A test case begins with the length of the sequence (), followed by the integers that make up the sequence. Every number is at least and less than .
Output
For each test case, print one line containing "EVEN" if the sum of the even numbers is larger than the sum of the odd numbers, "ODD" if the sum of the odd numbers is larger, or "TIE" if the two sums are equal.