結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー 👑 kakel-sankakel-san
提出日時 2022-08-28 23:07:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 735 bytes
コンパイル時間 1,188 ms
コンパイル使用メモリ 110,560 KB
実行使用メモリ 27,252 KB
最終ジャッジ日時 2024-04-23 19:00:11
合計ジャッジ時間 4,892 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,864 KB
testcase_01 AC 27 ms
24,960 KB
testcase_02 AC 28 ms
24,988 KB
testcase_03 AC 28 ms
24,876 KB
testcase_04 AC 29 ms
25,132 KB
testcase_05 AC 29 ms
27,252 KB
testcase_06 AC 27 ms
24,956 KB
testcase_07 AC 29 ms
26,864 KB
testcase_08 AC 29 ms
25,136 KB
testcase_09 AC 27 ms
25,244 KB
testcase_10 AC 28 ms
24,880 KB
testcase_11 AC 28 ms
22,964 KB
testcase_12 AC 27 ms
25,080 KB
testcase_13 AC 28 ms
26,876 KB
testcase_14 AC 29 ms
24,860 KB
testcase_15 AC 28 ms
25,240 KB
testcase_16 AC 28 ms
27,148 KB
testcase_17 AC 28 ms
25,132 KB
testcase_18 AC 27 ms
24,984 KB
testcase_19 AC 28 ms
25,240 KB
testcase_20 AC 28 ms
25,008 KB
testcase_21 AC 28 ms
27,136 KB
testcase_22 AC 28 ms
25,008 KB
testcase_23 AC 27 ms
25,080 KB
testcase_24 AC 29 ms
27,008 KB
testcase_25 AC 27 ms
24,864 KB
testcase_26 AC 28 ms
25,344 KB
testcase_27 AC 28 ms
27,132 KB
testcase_28 AC 28 ms
25,208 KB
testcase_29 AC 30 ms
26,996 KB
testcase_30 AC 28 ms
25,080 KB
testcase_31 AC 28 ms
24,820 KB
testcase_32 AC 29 ms
26,996 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

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();
    static void Main()
    {
        var c = NList;
        var (a, n) = (c[0], c[1]);
        var mod = 998_244_353;
        var res = Exp(a, n, mod);
        WriteLine(mod);
        WriteLine(res);
    }
    static long Exp(long n, long k, int mod)
    {
        if (k == 0) return 1;
        if (k == 1) return n % mod;
        var half = Exp(n, k / 2, mod);
        var result = (half * half) % mod;
        return ((k % 2) == 0) ? result : ((result * n) % mod);
    }
}
0