結果

問題 No.2023 Tiling is Fun
ユーザー どららどらら
提出日時 2022-08-07 01:13:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,174 bytes
コンパイル時間 4,530 ms
コンパイル使用メモリ 228,344 KB
実行使用メモリ 18,832 KB
最終ジャッジ日時 2023-10-15 01:41:52
合計ジャッジ時間 6,186 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
18,532 KB
testcase_01 AC 26 ms
18,508 KB
testcase_02 AC 26 ms
18,756 KB
testcase_03 AC 26 ms
18,832 KB
testcase_04 AC 27 ms
18,476 KB
testcase_05 AC 27 ms
18,488 KB
testcase_06 AC 26 ms
18,528 KB
testcase_07 AC 27 ms
18,308 KB
testcase_08 AC 26 ms
18,544 KB
testcase_09 AC 27 ms
18,312 KB
testcase_10 AC 26 ms
18,480 KB
testcase_11 AC 26 ms
18,440 KB
testcase_12 AC 26 ms
18,508 KB
testcase_13 AC 25 ms
18,544 KB
testcase_14 AC 27 ms
18,424 KB
testcase_15 AC 26 ms
18,760 KB
testcase_16 AC 25 ms
18,772 KB
testcase_17 AC 26 ms
18,528 KB
testcase_18 AC 26 ms
18,536 KB
testcase_19 AC 27 ms
18,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}

0