Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

British Informatics Olympiad 2018 Round One Exam, Exercises of Mathematics

Instructions and questions for the 2018 british informatics olympiad round one exam. The exam consists of three questions: debt repayment, decoder ring, and serial numbers. Students are required to write programs and provide written answers for various parts of the questions.

Typology: Exercises

2021/2022

Uploaded on 09/27/2022

myohmy
myohmy 🇬🇧

4.8

(10)

300 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Time allowed: 3 hours
The 2018 British Informatics Olympiad
Instructions
You should write a program for part (a) of each question, and produce written answers to the
remaining parts. Programs may be used to help produce the answers to these written questions but
are not always necessary.
You may use a calculator and the on-line help that your programming language provides. You should
have a pen, some blank paper, and an empty USB stick (or other storage device) on which to save
your programs. You must not use any other material such as files on a computer network, books or
other written information. You may not communicate with anyone, other than the person invigilating
this paper.
Mark the first page of your written answers with your name, age in years and school/college. Number
all pages in order if you use more than one sheet. All of your computer programs should display your
name and school/college when they are run, and the storage device you use to submit the programs
should also show your name and school/college.
For your programs to be marked, the source code must be saved, along with executables if your
language includes a compiler; this includes programs used to help answer written questions. You
must clearly indicate the name given to each program on your answer sheet(s).
Sample runs are given for parts 1(a), 2(a) and 3(a). Bold text indicates output from the program,
and normal text shows data that has been entered. Where multiple items of input appear on the
same line they should be separated by a single space. The output format of your programs should
follow the ‘sample run’ examples. Your programs should take less than 1 second of processing time
for each test.
Attempt as many questions as you can. Do not worry if you are unable to finish this paper in the time
available. Marks allocated to each part of a question are shown in square brackets next to the
questions. Partial solutions (such as programs that only get some of the test cases correct within the
time limit, or partly completed written answers) may get partial marks.
Questions can be answered in any order, and you may answer the written questions without
attempting the programming parts.
Hints
If you can only see how to solve part of a problem it is worth writing a program that solves that part.
We want to give you marks and questions are evaluated using multiple tests of differing difficulty.
Remember, partial solutions may get partial marks.
Question 2 is an implementation challenge and question 3 is a problem solving challenge.
Most written questions can be solved by hand without solving the programming parts.
Do not forget to indicate the name given to your programs on your answer sheet(s).
pf3
pf4

Partial preview of the text

Download British Informatics Olympiad 2018 Round One Exam and more Exercises Mathematics in PDF only on Docsity!

Time allowed: 3 hours

The 2018 British Informatics Olympiad

Instructions

You should write a program for part (a) of each question, and produce written answers to the

remaining parts. Programs may be used to help produce the answers to these written questions but

are not always necessary.

You may use a calculator and the on-line help that your programming language provides. You should

have a pen, some blank paper, and an empty USB stick (or other storage device) on which to save

your programs. You must not use any other material such as files on a computer network, books or

other written information. You may not communicate with anyone, other than the person invigilating

this paper.

Mark the first page of your written answers with your name, age in years and school/college. Number

all pages in order if you use more than one sheet. All of your computer programs should display your

name and school/college when they are run, and the storage device you use to submit the programs

should also show your name and school/college.

For your programs to be marked, the source code must be saved, along with executables if your

language includes a compiler; this includes programs used to help answer written questions. You

must clearly indicate the name given to each program on your answer sheet(s).

Sample runs are given for parts 1(a), 2(a) and 3(a). Bold text indicates output from the program,

and normal text shows data that has been entered. Where multiple items of input appear on the

same line they should be separated by a single space. The output format of your programs should

follow the ‘sample run’ examples. Your programs should take less than 1 second of processing time

for each test.

Attempt as many questions as you can. Do not worry if you are unable to finish this paper in the time

available. Marks allocated to each part of a question are shown in square brackets next to the

questions. Partial solutions (such as programs that only get some of the test cases correct within the

time limit, or partly completed written answers) may get partial marks.

Questions can be answered in any order, and you may answer the written questions without

attempting the programming parts.

Hints

  • (^) If you can only see how to solve part of a problem it is worth writing a program that solves that part.

We want to give you marks and questions are evaluated using multiple tests of differing difficulty.

Remember, partial solutions may get partial marks.

  • (^) Question 2 is an implementation challenge and question 3 is a problem solving challenge.
  • (^) Most written questions can be solved by hand without solving the programming parts.
  • (^) Do not forget to indicate the name given to your programs on your answer sheet(s).

Question 1: Debt Repayment

At the end of every month interest is added to a debt (initially 100) and then repayments are taken off.

The interest is a fixed percentage of the current debt. The repayment is also a fixed percentage of the

debt (after the interest has been added) or 50, whichever is larger. If the repayment is greater than the

debt it is reduced to match the debt. The cycle of interest and repayment is continued until the debt has

been reduced to 0 and paid off.

For example, suppose the interest is 10% and repayments are 50%:

  • At the end of the first month the interest is 10, increasing the debt to 110;
  • The repayment is 55 (50% of 110) leaving the debt at 55;
  • At the end of the second month the interest is 5.5, increasing the debt to 60.5;
  • The repayment is 50 (as 50% of 60.5 is less than the minimum amount), leaving the debt at 10.5;
  • At the end of the third month the interest is 1.05, increasing the debt to 11.55;
  • The repayment is 11.55 (the minimum payment of 50 is reduced to match the debt) and the debt is

paid off.

  • The total amount repaid on the debt is 116.

When calculating percentages the amount is rounded up to 2 decimal places. E.g. 10.201 and 10.

would both be rounded up to 10.21.

1(a) [ 26 marks ]

Write a program that reads in the interest percentage followed by the repayment

percentage. Percentages will be integers between 0 and 100 (inclusive).

You should output the total amount repaid.

You will always be given input that allows the debt to be paid off.

Sample run 1

10 50

116.

1(b) [ 2 marks ]

Given an interest percentage of 43% and a repayment percentage of 46%, how many payments will be

made to pay off the debt?

1(c) [ 3 marks ]

Which interest and repayment percentages (integers between 0 and 100) lead to the largest amount repaid

on a debt that is paid off?

Question 3: Serial Numbers

A serial number can be transformed into another, by swapping two adjacent digits, so long as one of

those two digits is adjacent to a digit whose value lies between them. Two serial numbers will be called

equivalent if there is a sequence of transformations which changes one into the other, and the distance

between them is the minimum number of such transformations required.

For example, the following shows all the serial numbers that are equivalent to 146235 , the lines showing

all the valid transformations:

146235

142635

461235 416235 412635 142365 124365 124635

412365

The distance from 461235 to 124635 is 6, and from 412635 to 142635 is 1.

3(a) [ 24 marks ]

Write a program that determines the largest distance between a serial number and

any equivalent number.

Your program should input a single integer d ( 1 ≤ d ≤ 9) indicating the number of

digits in the serial number, followed by a d digit serial number which will consist of

the numbers 1,..., d without repetition.

You should output a single integer giving the largest distance.

Sample run

6

3(b) [ 4 marks ]

What is the largest distance between any two serial numbers equivalent to 326451? How about

3(c) [ 6 marks ]

What is the size of the largest set of serial numbers, none of which are equivalent, each consisting of the

digits 1,...,5 without repetition? What is the size if the serial numbers consist of the digits 1,...,9 without

repetition?

Total Marks: 100 End of BIO 2018 Round One paper