結果

問題 No.2299 Antitypoglycemia
ユーザー hiro71687k
提出日時 2023-05-16 04:04:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 3,592 ms
コンパイル使用メモリ 251,572 KB
最終ジャッジ日時 2025-02-13 00:45:48
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=14449999999999;
ll mod=998244353;
int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    vector<ll>x(n+1,1);
    for (ll i = 1; i <=n; i++)
    {
        x[i]=x[i-1]*i;
        x[i]%=mod;
    }
    if (a==b)
    {
        ll ans=x[n];
        ans+=mod-x[n-1];
        ans%=mod;
        ans+=mod-x[n-1];
        ans%=mod;
        cout << ans << endl;
    }else{
        ll ans=x[n];
        ans+=mod-x[n-1];
        ans%=mod;
        ans+=mod-x[n-1];
        ans%=mod;
        ans+=x[n-2];
        ans%=mod;
        cout << ans << endl;
    }
}
0