计算

[BJOI2012] 算不出的等式 - 数学

Solution

打表后发现若 \(p=q\)\((pq-1)/4\),否则 \((p-1)(q-1)/4\)

#include <bits/stdc++.h>
using namespace std;

#define int long long

int p,q;

signed main() {
    cin>>p>>q;
    if(p==q) cout<<(p*q-1)/4;
    else cout<<(p-1)*(q-1)/4;
}

相关文章:

  • 2022-01-19
  • 2022-03-04
  • 2022-01-11
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
相关资源
相似解决方案