結果

問題 No.2176 LRM Question 1
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-04 20:48:48
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 774 bytes
コンパイル時間 2,240 ms
コンパイル使用メモリ 67,500 KB
実行使用メモリ 38,812 KB
最終ジャッジ日時 2023-09-04 20:48:58
合計ジャッジ時間 5,364 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,796 KB
testcase_01 AC 60 ms
19,696 KB
testcase_02 AC 102 ms
38,812 KB
testcase_03 RE -
testcase_04 AC 91 ms
36,888 KB
testcase_05 AC 63 ms
21,756 KB
testcase_06 AC 63 ms
23,708 KB
testcase_07 AC 63 ms
23,796 KB
testcase_08 AC 91 ms
36,804 KB
testcase_09 AC 89 ms
36,432 KB
testcase_10 AC 102 ms
36,324 KB
testcase_11 RE -
testcase_12 AC 54 ms
21,784 KB
testcase_13 AC 87 ms
36,892 KB
testcase_14 AC 99 ms
38,756 KB
testcase_15 AC 93 ms
35,664 KB
testcase_16 AC 89 ms
31,216 KB
testcase_17 AC 62 ms
21,948 KB
testcase_18 AC 86 ms
33,292 KB
testcase_19 AC 79 ms
30,876 KB
testcase_20 AC 69 ms
24,460 KB
testcase_21 AC 78 ms
27,596 KB
testcase_22 AC 64 ms
21,780 KB
testcase_23 AC 78 ms
26,700 KB
testcase_24 AC 71 ms
27,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (l, r, m) = (c[0], c[1], c[2]);
        var f = new long[m];
        f[1] = 1;
        var dp = new long[m];
        dp[1] = 1;
        for (var i = 2; i < m; ++i)
        {
            f[i] = f[i - 1] * i % m;
            dp[i] = dp[i - 1] * f[i] % m;
        }
        var ans = 0L;
        for (var i = l; i <= r && i < m; ++i) ans = (ans + dp[i]) % m;
        WriteLine(ans);
    }
}
0