結果

問題 No.2079 aaabbc
ユーザー 👑 kakel-sankakel-san
提出日時 2022-09-25 21:34:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 1,740 ms
コンパイル使用メモリ 67,556 KB
実行使用メモリ 22,844 KB
最終ジャッジ日時 2023-08-24 02:04:20
合計ジャッジ時間 3,244 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
20,752 KB
testcase_01 AC 53 ms
22,844 KB
testcase_02 AC 51 ms
20,780 KB
testcase_03 AC 54 ms
20,828 KB
testcase_04 AC 53 ms
20,796 KB
testcase_05 AC 53 ms
20,752 KB
testcase_06 AC 54 ms
20,780 KB
testcase_07 AC 53 ms
20,684 KB
testcase_08 AC 54 ms
22,732 KB
testcase_09 AC 54 ms
22,744 KB
testcase_10 AC 54 ms
20,852 KB
testcase_11 AC 53 ms
20,708 KB
testcase_12 AC 53 ms
18,628 KB
testcase_13 AC 52 ms
20,692 KB
testcase_14 AC 54 ms
20,760 KB
testcase_15 AC 52 ms
20,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        WriteLine(Exp(3, n, 998_244_353));
    }
    static long Exp(int n, int 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