Department of Computer Science, CTU FEE & Czech ACM Chapter CTU Open Contest 1998
## The Okurkons FamilyDear contestants: In this round of 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 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! The Organization Team ## 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 SpecificationAt the first line there is a positive integer ## Output SpecificationThe program must print exactly one line for each query. The line should
contain the text " Minimum number of weightings is ) where XX is
the minimum number of weightings necessary to determine the genuine coin.
## Sample Input2 12 3 ## Output for Sample InputMinimum number of weightings is 3. Minimum number of weightings is 3. ## Reversi( ## Tchyne (Mother-In-Law)( Tonik likes biking very much and makes a lot of trips to various places. Nowadays he is not so enthusiastic and doesn't look forward to another biking trip. The reason of this is his mother-in-law (MIL) who decided to join him on every trip he makes. Can you imagine how happy Tonik was when he learned this decision of his MIL. Fortunately you can help him. After several trips Tonik noticed that his MIL was so exhausted after climbing a certain number of meters that she was unable to go on. That's why he decided to arrange their next trip a little bit different. They both will start from the same spot and either of them has to get to the destination by his/her own. Your task is to write a program to help Tonik decide whether MIL can reach the destination or not. ## Input SpecificationAt the first line there is a positive integer The spots are connected by roads which form a rectangular grid. The roads
between two neighbour spots are always just up the hill, just down the hill,
or level. At the first input line following the map definition, there is
exactly one number ## Output SpecificationThe program must print exactly one line for each query. The line should
contain the text " ## Sample Input2 3 3 1 2 3 2 3 2 3 2 1 1 1 1 3 3 6 5 1 2 3 4 5 9 8 7 6 5 1 2 3 4 5 1 9 9 9 9 7 5 5 5 5 1 1 1 1 1 8 1 1 6 2 ## Output for Sample InputTchyne nedojede. Tchyne muze dojet. ## Zlomky (Fractions)( A little boy Tonicek Okurkon is in the age when children attend elementary school. Most of the children are not quite convinced that this is very useful, however they go sometimes to school for some reason. Imagine the difference between smoking alone somewhere far behind the town and having a cigarette at the school's loo together with other school mates. The teacher has another trouble with little Tonicek. Attending the school
is not the biggest proublem while keeping Tonicek quite seems almost
impossible. The teacher was thinking for a long time and finaly found a
solution: Tonicek is given a set of mathematical examples with fractions and
has to stay in school until he solves them all. Tonicek doesn't like it
because more than in fractions is he interested in the last version of
## Input SpecificationAt the first line there is a positive integer `(`*expression*`)`*expression*operator*expression*(operator is one of`+`,`-`,`*`, or`/`)- number (may be signed)
Expressions are evaluated left to right using standard priorities of
operators. After execution of every elementar operation it is possible to
represent the result as a quotient of two integer numbers (standard type
## Output SpecificationThe program prints one line "Result is X." for each example where X is the value of the expression. If the result can be represented only as a quotient, it must be reduced as much as possible. Sample input 7 9/19-4/19+2/19 2/3+1/3 +21/+20*-2/+3 +4/+5++5/+6 (3/4)/(5/7) 45/4/6/5/7 (10000/10000)*(10000/10000)*(10000/10000) Sample output Result is 7/19. Result is 1. Result is -7/10. Result is 49/30. Result is 21/20. Result is 3/56. Result is 1. |

You are visitor number | since September 19th, 1999. |