Saturday, May 22, 2010

SPOJ - Rectangles Counting

Recently solved problem #3890 - MRECTCNT.

If you want to solve the problem yourself - stop reading now.

Solution

Count the number of pairs
(a,b), a ≤ b and a + b - GCD(a,b) = squares.

Note: Monkey counting is fast enough.

My SPOJ account

No comments:

Post a Comment