题解:P12105 [NWRRC2024] Another Brick in the Wall
Wendy_Hello_qwq · · 题解
题目传送门。
题意
给定一堵宽
分析
首先对于墙面宽
分类讨论结束后,根据条件判断并输出即可,代码十分简短。
Code
// P12105 [NWRRC2024] Another Brick in the Wall
#include <cstdio>
using namespace std;
int l, h;
signed main() {
scanf ("%d%d", &l, &h);
// 分类讨论,l 为偶数
if (l % 2 == 1) printf ("%d", h);
// l 为奇数
else printf ("%d", 2 * (h / 2));
return 0;
}
AC 记录。
完结撒花。