跳到正文

题解

题解:P15192 [SWERC 2019] Rats

NegetiveEdgeWeight约 1 分钟
原文
文章信息与版本

文章信息

收录
2026年2月5日
更新
2026年2月5日
篇幅
约 1 分钟
题目
P15192

版本

  1. v1当前

题解:P15192 [SWERC 2019] Rats

注意到题目已经给出怎么计算了,套公式就可以了。

注意 int 类型除以 int 类型还是 int,要转为浮点数。下取整用 floor 函数。

C++
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n1,n2,n12;
    cin>>n1>>n2>>n12;
    cout<<(int)floor((1.0*n1+1)*(1.0*n2+1)/(1.0*n12+1)-1);
    return 0;
}
原文