結果

問題 No.2527 H and W
ユーザー hiro1729hiro1729
提出日時 2023-11-03 21:26:41
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 2,634 bytes
コンパイル時間 4,688 ms
コンパイル使用メモリ 309,824 KB
実行使用メモリ 50,340 KB
最終ジャッジ日時 2023-11-03 21:26:59
合計ジャッジ時間 10,375 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
50,340 KB
testcase_01 AC 174 ms
50,340 KB
testcase_02 AC 179 ms
50,340 KB
testcase_03 AC 168 ms
50,340 KB
testcase_04 AC 187 ms
50,340 KB
testcase_05 AC 173 ms
50,340 KB
testcase_06 AC 173 ms
50,340 KB
testcase_07 AC 162 ms
50,340 KB
testcase_08 AC 175 ms
50,340 KB
testcase_09 AC 162 ms
50,340 KB
testcase_10 AC 151 ms
50,340 KB
testcase_11 AC 163 ms
50,340 KB
testcase_12 AC 169 ms
50,340 KB
testcase_13 AC 163 ms
50,340 KB
testcase_14 AC 166 ms
50,340 KB
testcase_15 AC 176 ms
50,340 KB
testcase_16 AC 180 ms
50,340 KB
testcase_17 AC 194 ms
50,340 KB
testcase_18 AC 178 ms
50,340 KB
testcase_19 AC 171 ms
50,340 KB
testcase_20 AC 172 ms
50,340 KB
testcase_21 AC 175 ms
50,340 KB
testcase_22 AC 169 ms
50,340 KB
testcase_23 AC 174 ms
50,340 KB
testcase_24 AC 161 ms
50,340 KB
testcase_25 AC 156 ms
50,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#if __has_include(<bits/stdc++.h>)
#include <bits/stdc++.h>
#else
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <numeric>
#include <iomanip>
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define rvrep(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(auto i:v)
#define all(x) x.begin(),x.end()
template<typename T>inline bool chmax(T &a,T b){return((a<b)?(a=b,true):(false));}
template<typename T>inline bool chmin(T &a,T b){return((a>b)?(a=b,true):(false));}
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using pii=pair<int,int>;using vpii=vector<pii>;using pll=pair<ll,ll>;using vpll=vector<pll>;using pli=pair<ll,int>;using pil=pair<int,ll>;
using mpi=map<int,int>;using mps=map<string,int>;using mpc=map<char,int>;using mpl=map<ll,int>;
using sti=set<int>;using stc=set<char>;using sts=set<string>;using stl=set<ll>;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353;
using mint1=modint1000000007;
#endif


// modcomb
struct mComb {
  private:
	bool _calced = false;
	int _mod = 998244353;
	vl _fac, _invf, _inv;
  public:
	void setmod(int m) { _mod = m; }
 	void init(int n) {
		_fac.resize(n + 1);
		_invf.resize(n + 1);
		_inv.resize(n + 1);
		_fac[0] = 1;
		_fac[1] = 1;
		_invf[0] = 1;
		_invf[1] = 1;
		_inv[1] = 1;
		reps(i, 2, n + 1) {
			_fac[i] = _fac[i - 1] * i % _mod;
			_inv[i] = _mod - _inv[_mod % i] * (_mod / i) % _mod;
			_invf[i] = _invf[i - 1] * _inv[i] % _mod;
		}
		_calced = true;
	}
	void _check() { if (!_calced) { cerr << "not initialized\n"; exit(1); } }
	ll F(int n) { _check(); return _fac[n]; }
	ll C(int n, int k) { _check(); return _invf[k] * _invf[n - k] % _mod * _fac[n] % _mod;}
	ll P(int n, int k) { _check(); return _invf[n - k] * _fac[n] % _mod;}
	ll H(int n, int k) { _check(); return _invf[k] * _invf[n-1] % _mod * _fac[n + k - 1] % _mod;}
};

int main() {
	ll h, w, k;
	cin >> h >> w >> k;
	mComb mc; mc.init(2000000);
	mint ans = 0;
	for (int i = 1; i <= h; i++) {
		if (k % i == 0 && k / i <= w) {
			ans += mc.C(h, i) * mc.C(w, k / i);
		}
	}
	cout << ans.val();
}
0