题解:P15192 [SWERC 2019] Rats
NegetiveEdgeWeight · · 题解
题解:P15192 [SWERC 2019] Rats
注意到题目已经给出怎么计算了,套公式就可以了。
注意 int 类型除以 int 类型还是 int,要转为浮点数。下取整用 floor 函数。
#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;
}