結果

問題 No.2299 Antitypoglycemia
コンテスト
ユーザー bluemegane
提出日時 2023-05-13 16:00:14
言語 C#(csc)
(csc 3.9.0)
コンパイル:
csc -langversion:latest -unsafe -warn:0 -o+ /r:System.Numerics.dll _filename_ -out:a.exe
実行:
/usr/bin/mono a.exe
結果
WA  
実行時間 -
コード長 972 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,900 ms
コンパイル使用メモリ 104,704 KB
実行使用メモリ 18,688 KB
最終ジャッジ日時 2026-05-23 04:40:24
合計ジャッジ時間 4,745 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 20 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
raw source code

using static System.Math;
using System;

class Modulo
{
    public const int MOD = 998244353;
    private readonly int[] m_facs;
    public int Mul(int a, int b) => (int)(BigMul(a, b) % MOD);
    public Modulo(int n)
    {
        m_facs = new int[n + 1];
        m_facs[0] = 1;
        for (int i = 1; i <= n; ++i)
            m_facs[i] = Mul(m_facs[i - 1], i);
    }
    public int Fac(int n) => m_facs[n];
}

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var a = int.Parse(line[1]);
        var b = int.Parse(line[2]);
        getAns(n, a, b);
    }
    static void getAns(int n, int a, int b)
    {
        var md = new Modulo(n);
        var ans = md.Fac(n);
        ans -= 2 * md.Fac(n - 1);
        ans %= Modulo.MOD;
        if (ans < 0) ans += Modulo.MOD;
        ans += md.Fac(n - 2);
        ans %= Modulo.MOD;
        Console.WriteLine(ans);
    }
}
0