結果
問題 | No.2023 Tiling is Fun |
ユーザー |
![]() |
提出日時 | 2022-08-07 01:13:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 1,174 bytes |
コンパイル時間 | 3,874 ms |
コンパイル使用メモリ | 230,520 KB |
実行使用メモリ | 19,036 KB |
最終ジャッジ日時 | 2024-09-16 19:12:49 |
合計ジャッジ時間 | 5,338 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)#define rep(i,n) REP(i,0,n)#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)#define ALLOF(c) (c).begin(), (c).end()typedef long long ll;typedef unsigned long long ull;//using mint = modint1000000007;using mint = modint998244353;class modutils {vector<mint> fact, invfact;public:modutils(int n = 2000005):fact(n+1),invfact(n+1) {fact[0] = 1;for(int i=1; i<=n; i++) fact[i] = fact[i-1] * i;invfact[n] = fact[n].inv();for(int i=n; i>=1; i--) invfact[i-1] = invfact[i] * i;}mint pow(mint x, ll n) {return x.pow(n);}mint comb(ll n, ll k) {if(n<0 || k<0 || n<k) return 0;return fact[n] * invfact[k] * invfact[n-k];}mint perm(ll n, ll k) {if(n<0 || k<0 || n<k) return 0;return fact[n] * invfact[n-k];}mint fac(ll n) {return fact[n];}mint invfac(ll n) {return invfact[n];}};modutils mutil;int main(){int a, b;cin >> a >> b;cout << mutil.comb(a-1+b-1,a-1).val() << endl;return 0;}