当前位置: 代码迷 >> 综合 >> Contest3188 - 2021级新生个人训练赛第42场_E: K-City
  详细解决方案

Contest3188 - 2021级新生个人训练赛第42场_E: K-City

热度:89   发布时间:2023-12-06 05:31:11.0

//
问题 E: K-City
时间限制: 1.000 Sec  内存限制: 128 MB题目描述
In K-city, there are n streets running east-west, and m streets running north-south. 
Each street running east-west and each street running north-south cross each other. 
We will call the smallest area that is surrounded by four streets a block. 
How many blocks there are in K-city?Constraints
2≤n,m≤100
输入
Input is given from Standard Input in the following format:
n m
输出
Print the number of blocks in K-city.
样例输入 Copy
3 4
样例输出 Copy
6

//
#include<bits/stdc++.h>
using namespace std;int main()
{int n,m;                        // 2≤n,m≤100while( ~scanf("%d%d",&n,&m) ){printf("%d\n",(n-1)*(m-1) );}return 0;
}