1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
rows, cols, bins = 3, 3, 5
rows, cols, bins = 4, 4, 7
#rows, cols, bins = 5, 5, 10
#rows, cols, bins = 7, 7, 18
rows, cols, bins = 8, 8, 23
#rows, cols, bins = 9, 9, 28
#rows, cols, bins = 10, 10, 36
#rows, cols, bins = 11, 11, 42
print 3 * (rows - 1) * (cols - 1) + (rows - 1) + (cols - 1), rows * cols, bins
for r in range(rows - 1):
for c in range(r * cols + 1, (r+1) * cols):
print c, c + 1
print c, c + cols
print c, c + cols + 1
print (r+1) * cols, (r+2) * cols
for c in range(rows * cols - cols + 1, rows * cols):
print c, c + 1
|