結果

問題 No.1138 No Bingo!
ユーザー kotatsugamekotatsugame
提出日時 2020-07-27 01:36:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 3,000 ms
コード長 497 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 64,544 KB
実行使用メモリ 7,076 KB
最終ジャッジ日時 2023-09-11 05:30:49
合計ジャッジ時間 1,782 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,580 KB
testcase_01 AC 2 ms
5,436 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 5 ms
6,168 KB
testcase_04 AC 7 ms
7,076 KB
testcase_05 AC 2 ms
5,488 KB
testcase_06 AC 2 ms
5,352 KB
testcase_07 AC 2 ms
5,508 KB
testcase_08 AC 2 ms
5,348 KB
testcase_09 AC 5 ms
6,280 KB
testcase_10 AC 6 ms
7,064 KB
testcase_11 AC 6 ms
6,888 KB
testcase_12 AC 4 ms
5,916 KB
testcase_13 AC 2 ms
5,440 KB
testcase_14 AC 6 ms
6,892 KB
testcase_15 AC 4 ms
6,020 KB
testcase_16 AC 6 ms
6,780 KB
testcase_17 AC 6 ms
6,732 KB
testcase_18 AC 6 ms
6,728 KB
testcase_19 AC 4 ms
6,340 KB
testcase_20 AC 6 ms
6,772 KB
testcase_21 AC 6 ms
6,740 KB
testcase_22 AC 6 ms
6,564 KB
testcase_23 AC 2 ms
5,468 KB
testcase_24 AC 5 ms
6,216 KB
testcase_25 AC 4 ms
5,916 KB
testcase_26 AC 3 ms
5,836 KB
testcase_27 AC 4 ms
6,280 KB
testcase_28 AC 3 ms
5,876 KB
testcase_29 AC 3 ms
6,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const long mod=998244353;
int N;
long FAC,ALL[2<<17],TWO[2<<17];
main()
{
    cin>>N;
    FAC=1;
    for(int i=1;i<=N;i++)FAC=FAC*i%mod;
    ALL[1]=0;
    ALL[2]=1;
    for(int i=3;i<=N;i++)ALL[i]=(i-1)*(ALL[i-1]+ALL[i-2])%mod;
    TWO[0]=1;
    for(int i=3;i<=N;i++)
    {
        if(i%2==1)TWO[i]=((i-1)*TWO[i-1]+2*(i-1)*TWO[i-2])%mod;
        else TWO[i]=((i-1)*TWO[i-1]+2*(i-2)*TWO[i-4])%mod;
    }
    cout<<((FAC-2*ALL[N]+TWO[N])%mod+mod)%mod<<endl;
}
0