Datahub
数据改变生活

6608: Bichrome Cells

发表时间:2022-10-27 19:53

6608: Bichrome Cells

时间限制: 1 Sec   内存限制: 128 MB

题目描述

We have an N×N square grid.
We will paint each square in the grid either black or white.
If we paint exactly A squares white, how many squares will be painted black?

Constraints
1≤N≤100
0≤A≤N2

输入

Input is given from Standard Input in the following format:
N
A

输出

Print the number of squares that will be painted black.

样例输入 Copy

3

4

样例输出 Copy

5

提示

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

#include<bits/stdc++.h>

using namespace std;

int n,a;

int main(){

cin>>n>>a;

cout<<n*n-a<<endl;

return 0;

}


文章分类: 算法例题
分享到:
QQ:258506508                                     联系电话:020-000000    000-000000                                   联系邮箱:xxx@.co.m                                     联系地址:XXX省XXX市XXX县XXX路