結果

問題 No.2511 Mountain Sequence
ユーザー maksimmaksim
提出日時 2023-10-20 22:05:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 1,720 ms
コンパイル使用メモリ 167,584 KB
実行使用メモリ 9,884 KB
最終ジャッジ日時 2023-10-20 22:06:01
合計ジャッジ時間 7,899 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
9,836 KB
testcase_01 AC 134 ms
9,836 KB
testcase_02 AC 176 ms
9,884 KB
testcase_03 AC 140 ms
9,836 KB
testcase_04 AC 143 ms
9,884 KB
testcase_05 AC 136 ms
9,884 KB
testcase_06 AC 139 ms
9,884 KB
testcase_07 AC 138 ms
9,884 KB
testcase_08 AC 134 ms
9,884 KB
testcase_09 AC 138 ms
9,836 KB
testcase_10 AC 163 ms
9,884 KB
testcase_11 AC 145 ms
9,884 KB
testcase_12 AC 154 ms
9,836 KB
testcase_13 AC 138 ms
9,884 KB
testcase_14 AC 173 ms
9,884 KB
testcase_15 AC 148 ms
9,884 KB
testcase_16 AC 141 ms
9,884 KB
testcase_17 AC 147 ms
9,884 KB
testcase_18 AC 138 ms
9,884 KB
testcase_19 AC 145 ms
9,884 KB
testcase_20 AC 159 ms
9,884 KB
testcase_21 AC 160 ms
9,884 KB
testcase_22 AC 137 ms
9,884 KB
testcase_23 AC 145 ms
9,884 KB
testcase_24 AC 141 ms
9,884 KB
testcase_25 AC 136 ms
9,884 KB
testcase_26 AC 135 ms
9,884 KB
testcase_27 AC 159 ms
9,884 KB
testcase_28 AC 135 ms
9,836 KB
testcase_29 AC 161 ms
9,884 KB
testcase_30 AC 136 ms
9,884 KB
testcase_31 AC 135 ms
9,884 KB
testcase_32 AC 141 ms
9,884 KB
testcase_33 AC 132 ms
9,884 KB
testcase_34 AC 136 ms
9,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
const int p=998244353;
int po(int a,int b) {if(b==0) return 1; if(b==1) return a; if(b%2==0) {int u=po(a,b/2);return (u*u)%p;} else {int u=po(a,b-1);return (a*u)%p;}}
int inv(int x) {return po(x,p-2);}
const int maxn=4e5+5;
int fact[maxn];int invf[maxn];
int c(int n,int k)
{
    if(k>n) return 0;
    int ans=fact[n];ans*=invf[k];ans%=p;ans*=invf[n-k];ans%=p;return ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    fact[0]=1;for(int i=1;i<maxn;++i) {fact[i]=(fact[i-1]*i)%p;}
    for(int i=0;i<maxn;++i) {invf[i]=inv(fact[i]);}
    int n,m;cin>>n>>m;
    int ans=0;
    for(int k=0;k<=m-1;++k)
    {
        ans+=c(2*k,n-1);ans%=p;
    }
    cout<<(ans%p+p)%p;
    return 0;
}
0