A - Chocolate Bar Count
解説
/
/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 100 点
問題文
縦 30 行、横 30 列のマス目に区切られた長方形の板チョコがあり、各マスは 1 片のチョコレートに対応します。
この板チョコに対して、以下の操作を順に行います。
- 一番下の 1 行を取り除く操作を B 回行う。
- 一番右の 1 列を取り除く操作を R 回行う。
全ての操作が終わった時点で、板チョコには何片のチョコレートが残っていますか?
制約
- 入力は全て整数
- 1 \le B,R \le 29
入力
入力は以下の形式で標準入力から与えられる。
B R
出力
答えを出力せよ。
入力例 1
8 8
出力例 1
484
- まず、一番下の 1 行を取り除く操作を 8 回行う。
- これが終わった時点で、チョコレートは縦 22 行、横 30 列です。
- 一番右の 1 列を取り除く操作を 8 回行う。
- これが終わった時点で、チョコレートは縦 22 行、横 22 列です。
- 残っているチョコレートは 484 片です。
入力例 2
10 24
出力例 2
120
入力例 3
21 7
出力例 3
207
Score : 100 points
Problem Statement
There is a rectangular chocolate bar divided into a grid with 30 rows and 30 columns, where each cell corresponds to one piece of chocolate.
The following operations are performed on this chocolate bar in order.
- Perform the operation of removing the bottommost row B times.
- Perform the operation of removing the rightmost column R times.
How many pieces of chocolate remain in the chocolate bar after all operations are finished?
Constraints
- All input values are integers.
- 1 \le B,R \le 29
Input
The input is given from Standard Input in the following format:
B R
Output
Print the answer.
Sample Input 1
8 8
Sample Output 1
484
- First, the operation of removing the bottommost row is performed 8 times.
- After this, the chocolate bar has 22 rows and 30 columns.
- Then, the operation of removing the rightmost column is performed 8 times.
- After this, the chocolate bar has 22 rows and 22 columns.
- The number of remaining pieces of chocolate is 484.
Sample Input 2
10 24
Sample Output 2
120
Sample Input 3
21 7
Sample Output 3
207