1996--1997 ACM International Collegiate Programming Contest
Southwestern European Regional Contest
ETH Zürich, November 15, 1996
Practice Session

Sponsored by Microsoft
Supported by Union Bank of Switzerland


Problem Set (Practice Session)

Contents

  1. Floppies
  2. Golf
  3. Reverse Text


Problem A: Floppies

Source file:
Input file:
floppies.pas/floppies.c/floppies.C
floppies.in

In this age of Internet, on-line connections, instantaneous email, etc., there are still some people who need to work with floppy disks. John is one of those. Every evening he goes home and continues what he has been doing in his office on his private UNIX system. He copies all the files he needs to floppy disks according to the following procedure:

  1. Put all files in one big SHAR file.
  2. Compress the file.
  3. uuencode it, such that it is split in nice lines of 62 characters each (including the newline).
  4. Split it in files of 30,000 lines each (about 1.86Mb).
  5. Compress each of the files and put it on a floppy by itself.

So far, this procedure always worked, since 1.86Mb of uuencoded text, after compression, will nicely fit on a 1.44Mb floppy disk.

Now, given that through compression the size of the SHAR file halves and that uuencoding a compressed file adds 50% to its size (each rounded to the nearest integer number of bytes), we would like to know for a given size of the SHAR file how many floppies John needs.

Input Specification

The input file contains several test cases. Each test case consists of a single line containing one integer s (0 <= s <= 1,000,000,000), specifying the size of the SHAR file in bytes.

The file ends with a file having s = 0. Do not generate output for this file.

Output Specification

For each test case, first output the number of the test case (`File #1', `File #2', etc.), followed by a line that contains the minimal number of floppies needed for the transfer and a blank line. Adhere to the format shown below in the sample output.

Input Sample

1000000
10000000
100000000
0

Output for Sample Input

File #1
John needs 1 floppies.


File #2
John needs 5 floppies.


File #3
John needs 41 floppies.

[End of Problem A]


Problem B: Golf

Source file:
Input file:
golf.pas/golf.c/golf.C
golf.in

Whoever wants to learn the game of golf has to cope with several oddities first (as with every other game that originates from Great Britain). One of them is the way to count the number of strokes a player needed to put his golf ball in a hole. There is a ``par'' for every hole, and practically all scores are expressed relative to the par. Examples are terms like ``par'', ``birdie'' (1 below par) and ``bogey'' (1 over par), and, in rare cases, ``hole-in-one'', ``eagle'' (2 below par), ``double eagle'' (3 below par) and ``double bogey'' (2 over par). Although it is possible to get worse than a double bogey and there are names for those, too, we will just assume that most people will cheat and just write down ``double bogey'', anyway.

John has just joined a golf club and is new to all these names. On his first visit to the golf course, he just fills in the number of strokes for every hole in his score card. He now needs these numbers translated into their proper names.

As John's caddy, you are to write a program that, given the par for a hole and the number of strokes John wrote down, prints the proper name of the score. Make sure that you write a ``hole-in-one'' even if another description would fit as well.

Input Specification

The input file consists of several test cases. Each test case consists of a single line that contains two integers p and s, where p is the par for the hole (either 3, 4, or 5) and s is the number of strokes John needed for that hole, 1 <= s < 20.

The input ends with a hole having p = 0, which should not be processed.

Output Specification

For each test case, output a line containing the number of the hole (`Hole #1', `Hole #2', etc.).

On the next line print the proper name of the score, followed by a period, i.e. one of `Hole-in-one.', `Double eagle.', `Eagle.', `Birdie.', `Par.', `Bogey.', or `Double Bogey.'.

Output a blank line after each hole.

Sample Input

5 3
3 1
4 7
0 0

Output for Sample Input

Hole #1
Eagle.


Hole #2
Hole-in-one.


Hole #3
Double Bogey.

[End of Problem B]


Problem C: Reverse Text

Source file:
Input file:
reverse.pas/reverse.c/reverse.C
reverse.in

In most languages, text is written from left to right. However, there are other languages where text is read and written from right to left. As a first step towards a program that automatically translates from a left-to-right language into a right-to-left language and back, you are to write a program that changes the direction of a given text.

Input Specification

The input file contains several test cases. The first line contains an integer specifying the number of test cases in the file. Each test case consists of a single line of text which contains at most 70 characters. However, the newline character at the end of each line is not considered to be part of the line.

Output Specification

For each test case, print a line containing the characters of the input line in reverse order.

Sample Input

3
Frankly, I don't think we'll make much
money out of this scheme.
madam I'm adam

Output for Sample Input

hcum ekam ll'ew kniht t'nod I ,ylknarF
.emehcs siht fo tuo yenom
mada m'I madam

[End of Problem C]


Home Page. Comments. Last update: November 27, 1996 (eos).