A - Bichrome Cells 解説 /

実行時間制限: 2 sec / メモリ制限: 256 MiB

配点: 100100

問題文

N×NN \times N のマス目があります。

このマス目の各マスを白色または黒色に塗ることにしました (すべてのマスをどちらか片方の色に塗ります)。

ちょうど AA マスを白色に塗るとき、黒色に塗ることになるマスはいくつあるでしょうか。

制約

  • 1N1001≦N≦100
  • 0AN20 ≦ A ≦ N^2

入力

入力は以下の形式で標準入力から与えられる。

NN
AA

出力

黒色に塗ることになるマスの個数を出力せよ。


入力例 1Copy

Copy
3
4

出力例 1Copy

Copy
5

3×33 \times 3 のマス目にはマスが 99 個あります。 そのうち 44 個を白く塗るので、残った 55 マスは黒く塗ることになります。


入力例 2Copy

Copy
19
100

出力例 2Copy

Copy
261

入力例 3Copy

Copy
10
0

出力例 3Copy

Copy
100

白く塗るマスの個数が 00 なので、すべてのマスが黒く塗られます。

Score : 100100 points

Problem Statement

We have an N×NN \times N square grid.

We will paint each square in the grid either black or white.

If we paint exactly AA squares white, how many squares will be painted black?

Constraints

  • 1N1001 \leq N \leq 100
  • 0AN20 \leq A \leq N^2

Inputs

Input is given from Standard Input in the following format:

NN
AA

Outputs

Print the number of squares that will be painted black.


Sample Input 1Copy

Copy
3
4

Sample Output 1Copy

Copy
5

There are nine squares in a 3×33 \times 3 square grid. Four of them will be painted white, so the remaining five squares will be painted black.


Sample Input 2Copy

Copy
19
100

Sample Output 2Copy

Copy
261

Sample Input 3Copy

Copy
10
0

Sample Output 3Copy

Copy
100

As zero squares will be painted white, all the squares will be painted black.



2025-06-08 (日)
13:15:18 +00:00