#P2552. Zju2253 Fill the Grid

    ID: 1608 传统题 1000ms 512MiB 尝试: 34 已通过: 22 难度: 6 上传者: 标签>CF2100提高标准杨表钩长公式质因数指数约分试除法分解质因数高精度乘法

Zju2253 Fill the Grid

题目描述

Given an m×nm \times n grid, you're required to fill it with the numbers from 11 to m×nm \times n but the following rules should be satisfied:

  1. each number in grid is larger than its above;
  2. each number in grid is larger than its left.

Now, I wonder how many distinct solutions I could make on a grid.
For example. Consider such a 2×32 \times 3 grid, we have the following solutions:
123 124 134 135 125
456 356 256 246 346
Thus, the sum is 55.

输入格式

Two positive integer m,n(0<m,n<10)m, n (0 < m, n < 10) per line. Two zeros indicate the end of input.

输出格式

A single integer per line for each case -- the number of distinct solutions.

2 3
0 0
5

提示

本题为多组数据,请做到 0 0 结束。