Spookiel / British-Informatics-Olympiad-Solutions

Contains python solutions for the British Informatics olympiad
24 stars 9 forks source link

Added and improved solutions. #8

Open Pararcana opened 1 year ago

Pararcana commented 1 year ago

The solutions that were added were: 1995 Q1 - Text encoder-decoder 1996 Q1 - Amicable Numbers 1999 Q1 - Digital Rivers 2018 Q1 - Debt Repayment (previous one was partial, this solution is shorter, and scores full marks) 2018 Q2 - Decoder Ring 2020 Q1 - Roman Look-and-Say 2023 Q1 - Zeckendorf Representation 2023 Q3 - Dreaming Spires

The solutions that were improved were: 1997 Q1 - Time 1998 Q1 - Roman Numerals 2000 Q1 - Passwords 2000 Q2 - Ants 2002 Q1 - Lojban 2009 Q1 - Digit Words 2013 Q1 - Watching the Clock 2014 Q1 - Lucky Numbers 2019 Q1 - Palindromic Numbers 2022 Q1 - Decrypt

It was a huge nostalgia trip to revisit my BIO 2k solutions, and it made me realise how much I've improved since then, I hope you like the update. Especially BIO 2k Q1, I thought I had the perfect solution back then, but I managed to make the program 50% shorter. XD

Spookiel commented 1 year ago

Thanks for adding to the repo, I'll take a look at the merge request when I get the time. Could you please leave the code that generates the answers for the written questions? Alternatively you can write code that generates the answers to the written questions.

The other thing is that some solutions were chosen for readability and reproducability in contest. For example, one of the answers for Roman numerals is verbose, but I don't believe that people would find an arbitrary formula easy to understand. I'll keep your solution as it is concise, but the purpose of these solutions is so people can understand how they might write a solution in the contest :).

Pararcana commented 1 year ago

Ah, my bad. Funny thing was that I found out today, that my roman numeral solution had an error that didn't get picked up by the test cases in BIO or myself; it just goes to show how important readability is. I have updated it to be even more concise and readable (at least compared to the previous one). 👍

For the second point, I didn't realise that I accidentally got rid of the code for the written questions, although I believe that I've added all of them back (on Lojban & Decrypt).

Pararcana commented 11 months ago

All Q1s done.

Pararcana commented 11 months ago

@Spookiel Still remember this?