結果
問題 | No.2299 Antitypoglycemia |
ユーザー |
|
提出日時 | 2024-02-21 17:36:33 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 581 bytes |
コンパイル時間 | 21,937 ms |
コンパイル使用メモリ | 352,532 KB |
最終ジャッジ日時 | 2025-02-19 18:36:28 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; using ll=long long; void IO(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); } ll P(ll p,ll mod){ ll res=1; for(ll i=1;i<=p;i++){ res*=i; res%=mod; } return res; } int main(){ IO(); ll n,a,b; cin>>n>>a>>b; ll mod=998244353; ll ans=P(n,mod); ans-=2*P(n-1,mod); ans+=2*mod; ans%=mod; if(a!=b){ ans+=P(n-2,mod); ans%=mod; } cout<<ans<<endl; }