Submit | All submissions | Best solutions | Back to list |
MADN - The Mad Numerologist |
Numerology is a science that is used by many people to find out a mans personality, sole purpose of life, desires to experience etc. Some calculations of numerology are very complex, while others are quite simple. You can sit alone at home and do these easy calculations without taking any ones help. However in this problem you wont be asked to find the value of your name.
To find the value of a name modern numerologists have assigned values to all the letters of English Alphabet. The table above shows the numerical values of all letters of English alphabets. Five letters A, E, I, O, U are vowels. Rests of the letters are consonant. In this table all letters in column 1 have value 1, all letters in column 2 have value 2 and so on. So T has value 2, F has value 6, R has value 9, O has value 6 etc. When calculating the value of a particular name the consonants and vowels are calculated separately. The following picture explains this method using the name "CHRISTOPHER RORY PAGE".
So you can see that to find the consonant value, the values of individual consonants are added and to find the vowel value the values of individual vowels are added. A mad Numerologist suggests people many strange lucky names. He follows the rules stated below while giving lucky names.
- The name has a predefined length N.
- The vowel value and consonant value of the name must be kept minimum.
- To make the pronunciation of the name possible vowels and consonants are placed in alternate positions. Actually vowels are put in odd positions and consonants are put in even positions. The leftmost letter of a name has position 1; the position right to it is position 2 and so on.
- No consonants can be used in a name more than five times and no vowels can be used in a name more than twenty-one times
- Following the rules and limitations above the name must be kept lexicographically smallest. Please note that the numerologists first priority is to keep the vowel and consonant value minimum and then to make the name lexicographically smallest.
Input
First line of the input file contains an integer N (0 < N <= 250) that indicates how many sets of inputs are there. Each of the next N lines contains a single set of input. The description of each set is given below: Each line contains an integer n (0 < n < 211) that indicates the predefined length of the name.
Output
For each set of input produce one line of output. This line contains the serial of output followed by the name that the numerologist would suggest following the rules above. All letters in the output should be uppercase English letters.
Example
Input: 3 1 5 5 Output: Case 1: A Case 2: AJAJA Case 3: AJAJA
Added by: | Shashank Tandon |
Date: | 2012-12-27 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | ACM-ICPC Amritapuri Warmup |
hide comments
|
|||||||
2013-02-23 16:13:13 :C++:
@Ouditchya Sinha: your code is giving wrong answer for many cases... You haven't read the problem carefully... Please read it carefully then try... |
|||||||
2013-02-23 16:13:13 Ouditchya Sinha
@C++: please tell me where my code fails... it runs successfully on ideone. ID : 8618704 |
|||||||
2013-02-23 16:13:13 Ouditchya Sinha
My code is giving correct answer on ideone but it is giving wrong answer here, please tell me what's wrong? ID: 8572655 Last edit: 2013-01-29 13:54:57 |
|||||||
2013-02-23 16:13:13 MR. BEAN
remember to print Case, costed me a WA ... Last edit: 2013-01-14 19:13:16 |
|||||||
2013-02-23 16:13:13 Swapnil R.Mehta
please consider the image present here:- http://imageshack.us/photo/my-images/17/captureslx.png/ |
|||||||
2013-02-23 16:13:13 (Tjandra Satria Gunawan)(曾毅昆)
easy prob, AC on first try ;-) |
|||||||
2013-02-23 16:13:13 :C++:
All submissions have been rejudged... Sorry for the inconvinience... |
|||||||
2013-02-23 16:13:13 Aditya Pande
@problem setter: thank you.. Last edit: 2013-01-06 09:57:10 |
|||||||
2013-02-23 16:13:13 Kuldeep Fouzdar
@Shashank Tandon: Are you sure predefined length is less than 211. Because assertion is failed |
|||||||
2013-02-23 16:13:13 Jitesh
@shashank: I think you must check the test cases. It's showing me a TLE even though I got an AC during warmup. |