結果
| 問題 |
No.2299 Antitypoglycemia
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-12 21:25:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 514 bytes |
| コンパイル時間 | 525 ms |
| コンパイル使用メモリ | 66,856 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-28 17:14:37 |
| 合計ジャッジ時間 | 1,421 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int N,A,B;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N>>A>>B;
if(A==B)
{
mint ans=N-2;
for(int i=1;i<=N-1;i++)ans*=i;
cout<<ans.val()<<endl;
}
else
{
mint ans=0;
{
//P[1]==B
mint now=1;
for(int i=1;i<=N-1;i++)now*=i;
ans+=now;
}
{
//P[1]!=B
mint now=N-2;
now*=N-2;
for(int i=1;i<=N-2;i++)now*=i;
ans+=now;
}
cout<<ans.val()<<endl;
}
}