The problem is from codeforces: http://www.codeforces.com/problemset/problem/268/C
This problem is put at the third problem in the online contests. But it seems too easy for being in that place. The sample inputs are there to complicate the problem but if you pay attention to the problem description, you will simplify the problem as putting the maximum number of points in the rectangle area, where
The solution is thus simple, place, start from (0, n) and each time, increase x and decrease y, until the point reaches the x axis. The count of the numbers is
#!/usr/bin/env python
n, m = map(int, raw_input().split())
k = min(n, m)
print k + 1
for x in xrange(k + 1):
print x, k - x
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: Codeforces: 268B. Buttons
Next Post: Heron's Formula for the area of a triangle