


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
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
1 / 4
This page cannot be seen from the preview
Don't miss anything!
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%:
paid off.
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