Round 1 Problems

These problems were made available both here and on Computimes (in the Irish Times) on Monday 29th of January. They were also sent to all schools in Ireland on the same day.

1. Maximin

Write a program that will find the maximum and the minimum of a list of positive numbers.

Example

2. Egg Timer

Write a program that will ask the user for a whole number N between 3 and 10 and print an egg timer of size N.

Example

3. Remainder

You are given two words, and your job is to remove all letters from the first word that are contained in the second. For example, if you are given the words “computer program”, remove letters from the word “computer” if they occur in “program”, leaving the letters “cute”.

Example

4. Encryption

A secret code reorders the letters in a message using an array. E.g. the following message “Attack at dawn or we are done for” is placed in a 6*6 array : Blanks are replaced by asterisks, and full stops are added to the message so that it fills out the array. The coded message is obtained by reading down the columns, i.e. Write a program that will encode a message as above. Use an array with 6 columns, and adjust the number of rows depending on the message length.

Example

For extra marks, write a program to decode a message that has been encrypted using the above rules.

5. Come to Nothing

Consider the sequence of digits from 1 through N (where N <= 9) in increasing order: Insert either a + (for addition) or a - (for subtraction) between each of the digits so that the resultant sum is zero. Print all possible combinations that sum to zero.

Example


Irish Schools Programming Competition Timetable How to enter Rules DCU Computers Guidelines Sample Problems Previous Competitions IOI