logo AlgoBeat OnlineJudge
登录 注册

#102552. [BZOJ 2552] Zju2253 Fill the Grid

内存限制:128 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

Given an grid, you're required to fill it with the numbers from to 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 grid, we have the following solutions:
123 124 134 135 125
456 356 256 246 346
Thus, the sum is .

输入格式

Two positive integer per line. Two zeros indicate the end of input.

输出格式

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

样例

样例输入 #1

2 3
0 0

样例输出 #1

5

数据范围与提示

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

没有写明来源。