2640: More Vertexes, More Area

本文提供了一个使用C++编写的程序实例,通过该程序可以计算特定条件下的数值。程序首先包含了必要的头文件,并利用标准命名空间,接着通过读取两个整数参数进行计算并输出结果。本文适合对C++有一定了解的读者。

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,m,s;
    while(scanf("%d%d",&n,&m),n||m)
    {
  if(n==1||m==1) {printf("0/n");continue;}
        if(n%2==1&&m%2==1)
        {
            if(n<m) swap(n,m);
            s=(n-2)*(m-1)/2+(m-2)+(n-1)/2+1;
        }
        else
        {
            if(n%2==1) swap(n,m);
            s=(m-2)*n/2+n-1;
        }
        printf("%d/n",s);
    }
    return 0;
}

[root@localhost nocodb-project]# docker-compose up -d --build WARN[0000] /usr/local/bin/nocodb-project/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion [+] Building 0.0s (0/0) { "vertexes": [ { "digest": "sha256:b7a3e1705f9d67eefbb40ef26314b9439bf1c654646049863a468a7bdd640a4b", "name": "[internal] load local bake definitions", "started": "2025-11-14T12:01:16.508782743+08:00" } ] } { "statuses": [ { "id": "reading from stdin", "vertex": "sha256:b7a3e1705f9d67eefbb40ef26314b9439bf1c654646049863a468a7bdd640a4b", "current": 0, "timestamp": "0001-01-01T00:00:00Z", "started": "2025-11-14T12:01:16.508786803+08:00" } ] } { "statuses": [ { "id": "reading from stdin", "vertex": "sha256:b7a3e1705f9d67eefbb40ef26314b9439bf1c654646049863a468a7bdd640a4b", "current": 368, "timestamp": "0001-01-01T00:00:00Z", "started": "2025-11-14T12:01:16.508786803+08:00", "completed": "2025-11-14T12:01:16.509903134+08:00" } ] } { "statuses": [ { "id": "reading from stdin", "vertex": "sha256:b7a3e1705f9d67eefbb40ef26314b9439bf1c654646049863a468a7bdd640a4b", "current": 368, "timestamp": "0001-01-01T00:00:00Z", "started": "2025-11-14T12:01:16.508786803+08:00", "completed": "2025-11-14T12:01:16.509903134+08:00" } ] } { "vertexes": [ { "digest": "sha256:b7a3e1705f9d67eefbb40ef26314b9439bf1c654646049863a468a7bdd640a4b", "name": "[internal] load local bake definitions", "started": "2025-11-14T12:01:16.508782743+08:00", "completed": "2025-11-14T12:01:16.509917125+08:00" } ] } { "vertexes": [ { "digest": "sha256:a1cda4d63371bdf0762197232a2e9021e3b301ab34259711c798c11a2a299ae3", "name": "[internal] load build definition from Dockerfile" } ] } { "vertexes": [ { "digest": "sha256:a1cda4d63371bdf0762197232a2e9021e3b301ab34259711c798c11a2a299ae3", "name": "[internal] load build definition from Dockerfile", "started": "2025-11-14T04:01:16.582761925Z", "completed": "2025-11-14T04:01:16.582886246Z" }, { "digest": "sha256:a1cda4d63371bdf0762197232a2e9021e3b301ab34259711c798c11a2a299ae3", "name": "[internal] load build definition from Dockerfile", "started": "2025-11-14T04:01:16.583104488Z" } ] } { "statuses": [ { "id": "transferring dockerfile:", "vertex": "sha256:a1cda4d63371bdf0762197232a2e9021e3b301ab34259711c798c11a2a299ae3", "name": "transferring", "current": 0, "timestamp": "2025-11-14T04:01:16.589609826Z", "started": "2025-11-14T04:01:16.589609369Z" } ] } { "statuses": [ { "id": "transferring dockerfile:", "vertex": "sha256:a1cda4d63371bdf0762197232a2e9021e3b301ab34259711c798c11a2a299ae3", "name": "transferring", "current": 83, "timestamp": "2025-11-14T04:01:16.592862635Z", "started": "2025-11-14T04:01:16.589609369Z" } ] } { "statuses": [ { "id": "transferring dockerfile:", "vertex": "sha256:a1cda4d63371bdf0762197232a2e9021e3b301ab34259711c798c11a2a299ae3", "name": "transferring", "current": 229, "timestamp": "2025-11-14T04:01:16.594147881Z", "started": "2025-11-14T04:01:16.589609369Z", "completed": "2025-11-14T04:01:16.594147468Z" } ] } { "vertexes": [ { "digest": "sha256:a1cda4d63371bdf0762197232a2e9021e3b301ab34259711c798c11a2a299ae3", "name": "[internal] load build definition from Dockerfile", "started": "2025-11-14T04:01:16.583104488Z", "completed": "2025-11-14T04:01:16.59625657Z" } ] } Dockerfile:1 -------------------- 1 | >>> cat > Dockerfile << 'EOF' 2 | FROM nocodb/nocodb:latest 3 | RUN npm install mysql --production --legacy-peer-deps && npm cache clean --force -------------------- failed to solve: dockerfile parse error on line 1: unknown instruction: cat (did you mean cmd?) [root@localhost nocodb-project]# ^C [root@localhost nocodb-project]#
最新发布
11-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值