Code golf challenge for Round 869 D1D

Revision en1, by maomao90, 2023-04-30 08:55:21

Code golf challenge for 1817D - Toy Machine

In case you do not know what code golf is, the objective is to write the shortest code possible that solves the problem.

After losing 41 rating from Codeforces Round 869 (Div. 1) and almost becoming yellow again, I was depressed and decided to try to upsolve this problem. Surprisingly, I was able to discover a very simple pattern that allowed me to come up with a short and cute solution. Why do I always only solve problems after contest and not during contest 😭

Anyways, here is my code in python:


Here is my original C++ code that is more readable 204002089.

The prize for coming up with an even shorter code is an ego boost. Bonus points if you come up with an even simpler solution that is different from the pattern that I discovered.

Tags codegolf, constructive


  Rev. Lang. By When Δ Comment
en1 English maomao90 2023-04-30 08:55:21 973 Initial revision (published)