UVa 11236: Grocery Store is an unusual problem for UVa Online Judge: it takes no input! There’s just a problem statement explaining the rules for finding the output. The lack of input and the mathematical nature of the problem reminds me of the problems on Project Euler. And as with Project Euler, you could cheat the time limit by calculating the output offline and just having your program print it. But if you would rather write a program to solve this problem quickly, keep reading for ideas.
If you practice programming puzzles regularly, you probably keep an archive of your solutions. This can be useful for reference when you encounter similar problems. And even if you never look at some of them again, disk space is cheap and source code is small, so why not?
The simplest way to save your solutions is to put all of the files related to each solution (source code, input text, sample output text, etc.) in a directory on your local disk. I suggest going one step beyond that, and using a source control system to keep track of your solution files. These days, it makes sense to use Git.
For many years, Cal Newport has been writing about ways to get better at doing difficult things. His first three books were manuals for students, advice on learning techniques and where to focus one’s efforts during high school and college. In 2012, he wrote So Good They Can’t Ignore You, about building career capital by mastering valuable skills. While he was writing these four books, he also published the Study Hacks blog, which covers similar topics on a weekly basis.
Cal’s latest book, published last week, is Deep Work: Rules for Focused Success in a Distracted World. This one offers the following challenge: to improve your ability to do what is difficult, you first have to spend less time doing what is easy.