結果

問題 No.2527 H and W
ユーザー umezoumezo
提出日時 2023-11-03 22:55:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 1,771 ms
コンパイル使用メモリ 201,828 KB
実行使用メモリ 50,396 KB
最終ジャッジ日時 2023-11-03 22:55:41
合計ジャッジ時間 3,903 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
50,396 KB
testcase_01 AC 44 ms
50,396 KB
testcase_02 AC 54 ms
50,396 KB
testcase_03 AC 43 ms
50,396 KB
testcase_04 AC 61 ms
50,396 KB
testcase_05 AC 52 ms
50,396 KB
testcase_06 AC 55 ms
50,396 KB
testcase_07 AC 45 ms
50,396 KB
testcase_08 AC 54 ms
50,396 KB
testcase_09 AC 43 ms
50,396 KB
testcase_10 AC 43 ms
50,396 KB
testcase_11 AC 55 ms
50,396 KB
testcase_12 AC 53 ms
50,396 KB
testcase_13 AC 52 ms
50,396 KB
testcase_14 AC 54 ms
50,396 KB
testcase_15 AC 54 ms
50,396 KB
testcase_16 AC 52 ms
50,396 KB
testcase_17 AC 55 ms
50,396 KB
testcase_18 AC 55 ms
50,396 KB
testcase_19 AC 50 ms
50,396 KB
testcase_20 AC 51 ms
50,396 KB
testcase_21 AC 52 ms
50,396 KB
testcase_22 AC 66 ms
50,396 KB
testcase_23 AC 51 ms
50,396 KB
testcase_24 AC 47 ms
50,396 KB
testcase_25 AC 41 ms
50,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MOD=998244353;
const int MAX=2000200;
ll fac[MAX],finv[MAX],inv[MAX];

void init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<MAX;i++){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}

ll nCr(int n,int k){
  if(n<k) return 0;
  if(n<0 || k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  init();
  
  ll h,w,k;
  cin>>h>>w>>k;
  ll ans=0;
  ll a=h*w-k;
  rep(i,h){
    if((a-i*w)%(h-i)) continue;
    ll b=(a-i*w)/(h-i);
    ans=(ans+nCr(h,i)*nCr(w,b)%MOD)%MOD;
  }
  cout<<ans<<endl;
  
  return 0;
}
0