题目描述
Sum and Color
Chef is a mathematics student. His professor has given him a difficult task. Professor initially provides Chef with a list of numbers. For every number in the list, Chef has to calculate the sum 'S' of digits such that 0<=S<=9. Even if the sum of digits is coming as a 'n' digit number, Chef has to bring it down to 1 digit number by further calculating the sum of the n digits and so on. Each value of final one digit sum is assigned a color.
The color starts from index 0 to 9 and the value for each is given as follows:-
0-red
1-blue
2-pink
3-white
4-black
5-violet
6-cyan
7-yellow
8-green
9-brown
For each number in the list, Chef will obtain a 1 digit sum at the end. From these sums, Chef needs to find the color relating to the maximum 1 digit sum from the list.
Professor clarifies the problem through the following example:
Consider a list of 2 numbers 52 and 181. The addition of digits of number 52 gives 52=5+2=7, and that of 181 gives 181=1+8+1=10=1+0=1. So the maximum value is 7. So look at the color present at index 7 i.e. 'yellow'. So the output is yellow.
Help Chef write a program for this problem.
Input
The first line contains one integer ‘T’, which denotes Number of test cases.
There are 2 lines for each of ‘T’ test case
First line contains the total number of elements ’N’ in the list
Second line ‘N’ numbers (each number can be considered as ‘Ai’)separated by whitespaces.
Output
For each text case, You need to print one line containing the color obtained according to the maximum value of 'S' i.e. the color corresponding to maximum 1digit sum of number in the list
Constraints
1<=T<=100
1<=N<=250000
0<=Ai<=10^9
Example1
Input:
5
5
128 25 87 50 1558
4
11 22 33 44
3
36 14 1000
5
11112 95 96 256 2669
3
10 991 83
Output:
yellow
green
brown
cyan
pink
Explanation
Consider the 1st case:
Calculate sum of digits of every element
128=1+2+8=11=1+1=2
25=2+5=7
87=8+7=15=1+5=6
50=5+0=5
1558=1+5+5+8=19=1+9=10=1+0=1
So the maximum value is 7 and the output is the corresponding color to index 7 i.e.yellow.
输入格式
见题面
输出格式
见题面