AT_abc484_a.Chocolate Bar Count

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There is a rectangular chocolate bar divided into a grid with 3030 rows and 3030 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 BB times.
  • Perform the operation of removing the rightmost column RR times.

How many pieces of chocolate remain in the chocolate bar after all operations are finished?

有一个矩形巧克力棒,被划分为一个 3030 行 3030 列的网格,其中每个单元格对应一块巧克力。

按顺序对这个巧克力棒执行以下操作:

  • 执行 BB 次“移除最底行”的操作;
  • 执行 RR 次“移除最右列”的操作。

在所有操作完成后,巧克力棒中还剩下多少块巧克力?

输入格式

The input is given from Standard Input in the following format:

BB RR

输入从标准输入中以如下格式给出:

BB RR

输出格式

Print the answer.

输出答案。

输入输出样例

  • 输入#1

    8 8

    输出#1

    484
  • 输入#2

    10 24

    输出#2

    120
  • 输入#3

    21 7

    输出#3

    207

说明/提示

Sample 1 Explanation:

  • First, the operation of removing the bottommost row is performed 88 times.
    • After this, the chocolate bar has 2222 rows and 3030 columns.
  • Then, the operation of removing the rightmost column is performed 88 times.
    • After this, the chocolate bar has 2222 rows and 2222 columns.
  • The number of remaining pieces of chocolate is 484484.

Constraints

  • All input values are integers.
  • 1≤B,R≤291 \le B,R \le 29

样例 1 解释:

  • 首先,执行“移除最底行”操作 88 次。
    • 此后,巧克力块变为 2222 行、3030 列。
  • 接着,执行“移除最右列”操作 88 次。
    • 此后,巧克力块变为 2222 行、2222 列。
  • 剩余的巧克力块数量为 484484。

约束条件

  • 所有输入值均为整数。
  • 1≤B,R≤291 \le B,R \le 29

输入解题思路,AI测评打分。不知道怎么写?

首页