eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків

Cipher

A spy is using a clever cipher technique to encode and decode messages. The technique is very efficient as it enables him to send and receive any message, no matter how long it is with only three numbers! After many great efforts, The Department of National Security managed to figure out how the technique works: \begin{enumerate} \item First of all, the only characters used are the space and lower case English letters. Each character is assigned an integer called the character volume, a space character has volume \textbf{1}, '\textbf{a}' has volume \textbf{2}, '\textbf{b}' has volume \textbf{3} and so on until '\textbf{z}' which has volume \textbf{27}. The volume of the whole message \textbf{V} is the sum of volumes of characters in the message. \item A message consists of a number of words \textbf{W}, a word is a consecutive sequence of lower case letters, messages have no leading or trailing spaces and there is only one space between consecutive words. \item For a certain \textbf{V} and \textbf{W}, let \textbf{S} be the lexicographically sorted set of messages that have volume \textbf{V} and consists of exactly \textbf{W} words. We can refer to a certain message using its one-based index \textbf{I} in \textbf{S}. \end{enumerate} So when the spy wants to send a message \textbf{M}, he calculates its Volume \textbf{V} and the number of words it contains \textbf{W} and finds its index \textbf{I} in the corresponding set \textbf{S} (its index among all sorted messages of volume \textbf{V} with \textbf{W} words) and sends only three numbers along: \textbf{V}, \textbf{W} and \textbf{I}! The Department of National Security has done a great effort so far, yet they seek your help to decode messages sent by the spy! That is, given \textbf{V}, \textbf{W} and \textbf{I} you must decrypt the spy's message or determine that there is no such one! \InputFile The first line of input contains an integer (\textbf{1} ≤ \textbf{T} ≤ \textbf{200}), the number of test cases. Each data set consists of a line with three integers the volume of the message (\textbf{1} ≤ \textbf{V} ≤ \textbf{75}), the number of words (\textbf{1} ≤ \textbf{W} ≤ \textbf{20}), and the index of message (\textbf{1} ≤ \textbf{I} ≤ \textbf{10^18}). \OutputFile For each test case, print one line containing the decrypted message or "\textbf{Corrupted!}" if there is no valid message corresponding to the given inputs. \textbf{Hint} In the first test case, the sorted set of messages of volume 7 which contain 2 words is \{"a aa", "a c", "aa a", "b b", "c a"\}, hence the third and required message is “aa a”. In the second test case, the sorted set of messages of volume 2 which contain 1 word is \{"a"\}, the set has only one message while index 2 is required, so something must have gone wrong!
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
3
3 1 1
2 1 2
50 2 39098532022
Вихідні дані #1
Case #1: b
Case #2: Corrupted!
Case #3: big bang
Джерело The Third Lebanese Collegiate Programming Contest