Register

Login

CODECRAFT LEVEL FOUR

Problem 1:

Most of you have probably tried to type an SMS message on the keypad of a cellular phone. It is sometimes very annoying to write longer messages, because one key must be usually pressed several times to produce a single letter. It is due to a low number of keys on the keypad. Typical phone has twelve keys only (and maybe some other control keys that are not used for typing). Moreover, only eight keys are used for typing 26 letters of an English alphabet. The standard assignment of letters on the keypad is shown in the left picture:



Input:
The first line of the input contains a single integer T - a number of test cases. Each of the next T lines contains two integers separated by a single space - A and B.


Make a program that reads a number as input and prints the equivalent text as output. In case if the user needs to enter two characters displayed in the same key ,he uses a # in between. Assume that the text contains only lower case letters

Input:
66#6663377774447777

Output:
noesis



Problem 2:

The Okurkons Family

Beside Tonik Okurkon, the head of the family, you will also meet his pretty wife Juliet, young son Tonicek and little daughter Amalka.

You are to write a set of programs that help the Okurkons to deal with some of their problems. All the programs have to read the standard input, produce some results and send them to the standard output. All the numbers fit into the standard int or integer type, unless specified otherwise.

We strongly believe you will like the competition and find some interesting knowledge during it. Prehaps this knowledge may be useful not only in the Informatics field. Good luck!



Mince (Coins)

Tonik's grandmother was very thrifty and she stored all her savings into golden coins. Before she died she had divided these coins among her grandchildren so Tonik has one of his grandmother's golden coins. In order not the coin to be alone had Tonik several imitations made. The imitations were made so perfectly that it is impossible to say wheter the coin is fake or genuine just by having a look. That's why it was necessary to keep the genuine coin separated from the fake ones.

However Tonik lent Amalka all coins one day. She played with them and as you may expect she shuffled them. There is uneasy task for Tonik now: find the genuine coin. Fortunately he knows that all the fake coins have the same weight different from the weight of the genuine coin. He can use a balance and weights of 1, 2, 2, 5, 10, 20, 20, 50, 100, 200, 200, 500 and 1000 grammes. The weight of a coin (either genuine or fake) is an integer amount of grammes.

Your task is to write a program which for given number of coins calculates a minimum number of weightings necessary to determine the genuine coin and whether it is lighter or heavier than fake coins. One weighting means one comparing left and right side of the balance. It is possible to put any number of coins and weights on either side of the balance.

Input Specification
At the first line there is a positive integer N stating the number of assignments to follow. On each of the following N lines, there is exactly one integer K, K > 2 meaning K coins to examine (including the genuine one).

Output Specification
The program must print exactly one line for each query. The line should contain the text "Minimalni pocet vazeni je X." (Minimum number of weightings is X) where X is the minimum number of weightings necessary to determine the genuine coin.

Sample Input
2
12
3

Output for Sample Input
Minimum number of weightings is 3.
Minimum number of weightings is 3.













Copyright 2009.©Noesis 2009 
All rights reserved.

UPDATES

!!! Start crafting your code at Codecraft !!!

-Learner Guided for Ecotecture is availabel here.

-Online Registration will be  closed by 4th Sep 09

-Registration fees to be paid on  the spot on 5th Sep 9:30am

-Opening Ceremony -
        5th Sep 09 9:00am

-Events Starts-
        5th Sep 09 10:30am