This simple puzzle is from Timus Online Judge. Despite a lengthy description, the solution is really simple. The number of lines is the number of the seconds he needs …
The problem is from codeforces: http://codeforces.com/problemset/problem/245/A A really simple math problem, can be solved within a few lines of Python code: #!/usr/bin/env python ax = asum = 0 bx = …