結果

問題 No.2511 Mountain Sequence
ユーザー ぷらぷら
提出日時 2023-10-20 21:27:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 1,355 bytes
コンパイル時間 1,289 ms
コンパイル使用メモリ 133,084 KB
実行使用メモリ 50,396 KB
最終ジャッジ日時 2023-10-20 21:27:30
合計ジャッジ時間 3,981 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
50,396 KB
testcase_01 AC 46 ms
50,396 KB
testcase_02 AC 46 ms
50,396 KB
testcase_03 AC 50 ms
50,396 KB
testcase_04 AC 53 ms
50,396 KB
testcase_05 AC 49 ms
50,396 KB
testcase_06 AC 49 ms
50,396 KB
testcase_07 AC 57 ms
50,396 KB
testcase_08 AC 53 ms
50,396 KB
testcase_09 AC 47 ms
50,396 KB
testcase_10 AC 46 ms
50,396 KB
testcase_11 AC 46 ms
50,396 KB
testcase_12 AC 43 ms
50,396 KB
testcase_13 AC 46 ms
50,396 KB
testcase_14 AC 46 ms
50,396 KB
testcase_15 AC 48 ms
50,396 KB
testcase_16 AC 47 ms
50,396 KB
testcase_17 AC 44 ms
50,396 KB
testcase_18 AC 43 ms
50,396 KB
testcase_19 AC 59 ms
50,396 KB
testcase_20 AC 61 ms
50,396 KB
testcase_21 AC 46 ms
50,396 KB
testcase_22 AC 43 ms
50,396 KB
testcase_23 AC 44 ms
50,396 KB
testcase_24 AC 47 ms
50,396 KB
testcase_25 AC 48 ms
50,396 KB
testcase_26 AC 48 ms
50,396 KB
testcase_27 AC 49 ms
50,396 KB
testcase_28 AC 48 ms
50,396 KB
testcase_29 AC 46 ms
50,396 KB
testcase_30 AC 46 ms
50,396 KB
testcase_31 AC 48 ms
50,396 KB
testcase_32 AC 44 ms
50,396 KB
testcase_33 AC 45 ms
50,396 KB
testcase_34 AC 43 ms
50,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string.h>
#include <algorithm>
#include <array>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

constexpr int mod = 998244353;

void mpl(int &x,int y) {
    x += y;
    if(x >= mod) x -= mod;
}

long long fac[2000005], finv[2000005], inv[2000005];

void COMinit() {
    fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
    for (int i = 2; i < 2000005; 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;
    }
}

long long COM(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;
}

long long choose(int n,int k) {
    if(n < 0 || k < 0) return 0;
    if(n == 0) return 1;
    return COM(n+k-1,k-1);
}

int main() {
    COMinit();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    int ans = 0;
    for(int i = 1; i <= M; i++) {
        mpl(ans,COM((i-1)*2,N-1));
    }
    cout << ans << "\n";
}
0