TopCoder

Caido
$\mathbb{W}\mathcal{aimai}\sim$

User's AC Ratio

89.9% (347/386)

Submission's AC Ratio

37.0% (545/1471)

Tags

Description

由單位格子(i.e.大小為 $1\times 1$ 的格子)整齊排列而成的 $M \times N$ 的矩形裡面,總共有多少個正方形?

Input Format

輸入可能包含多組測試資料。每一筆測試資料各佔一列,包含兩個正整數 $M, N$ $(1\le M, N\le 1,000,000)$。
當 $M=N=0$ 的時候代表輸入結束,請參考輸入及輸出範例。測試資料組數不超過 $10,000$ 筆。

Output Format

對每一筆測試資料請輸出一個正整數S,為正方形的總數。

Sample Input 1

1 2
3 4
5 6
0 0

Sample Output 1

2
20
70

Hints

建議使用 long long型態儲存變數。

Problem Source

原TIOJ1015 / Problem Setter: Tmt

Subtasks

No. Testdata Range Score
1 0 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 500 65536 262144 1