結果

問題 No.2299 Antitypoglycemia
ユーザー D4Cngo_cppD4Cngo_cpp
提出日時 2023-05-12 23:38:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,189 bytes
コンパイル時間 3,283 ms
コンパイル使用メモリ 229,724 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-28 20:31:00
合計ジャッジ時間 26,541 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
#define reps(i, a, n) for(ll i = (a); i < (ll)(n); ++i)
#define rep(i,n) reps(i,0,n)
#define all(a) (a).begin(), (a).end();
#define debug(x) cerr << "\033[33m(line:" << __LINE__ << ") " << #x << ": " << x << "\033[m" << endl;

//なんかstd::vector<bool>の挙動を修正できるやつ

/* alias */
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vl = vector<long>;
using vll = vector<long long>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvll = vector<vll>;
using vs = vector<string>;
using pii = pair<int, int>;
using mint = modint998244353;

int mod = 998244353;
mint kaijo(ll n){
    if(n <= 1) return 1;
    return n*(n-1);
}

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    vll p(n+1);
    p[0] = 1;
    reps(i,1,n+1){
        p[i] = p[i-1] * i;
        p[i]%=mod;
        debug(p[i]);
    }
    ll ans = 1;
    if(a != b){
        ans = (n-1)*p[n-1] - (n-2)*p[n-2];
        ans%=mod;
    }else{
        ans = (n-1)*p[n-1] - (n-1)*p[n-2];
        ans%=mod;
    }

    cout << ans << endl;
    return 0;   
}
0