Name Tag Tally
A strange man has approached you and told you about a game. He has a bag of name tags, with each name consisting of lowercase English characters. Based on the name you receive, you will be assigned a score. The score is based on various criteria, and some of the parameters will change in different game rounds.
The score is based on the following, relying on variables ,
and
.
- For each vowel in the name, you receive
points (vowels are a, e, i, o, u).
- Consider each letter in your name as a number 0–25 ('a' is 0, 'b' is 1, etc.). If the sum of these numbers for all 3 characters in your name is a multiple of 3, you receive
points.
- If the name begins with one of the first five letters in the alphabet, you receive
points.
The parameters ,
and
may be negative, in which case, those would make you lose points.
To get an idea of the value of this game, you want to find out what the score should be, on average, rounded to 2 decimal places, when considering all possible permutations of lowercase characters.
Input
The first line consists of an integer
. This is the number of rounds the game will be played, with the parameters changing each round.
The next lines contain three space-separated integers
,
and
. These are the parameters that determine the scoring as outlined above for each different round.
Output
For each of the rounds, output the average value of a name tag, rounded to 2 decimal places.
Notes
You can print out the variable x
rounded to 2 decimal places using the following code.
- Python:
print(f"{x:.2f}")
- C++:
std::cout << std::fixed << std::setprecision(2) << x << '\n';
(you can removestd::
if you haveusing namespace std
at the top).
Example
Input 1
3
1 2 3
-3 3 1
0 0 1
Output 1
1.82
-0.54
0.19
Input 2
3
0 0 0
5 5 -8
9 8 7
Output 2
0.00
3.01
9.20
Comments