結果

問題 No.2752 文字列の数え上げ mod 998244353
ユーザー 👑 kakel-sankakel-san
提出日時 2024-05-22 23:49:40
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 1,163 bytes
コンパイル時間 11,578 ms
コンパイル使用メモリ 169,296 KB
実行使用メモリ 201,776 KB
最終ジャッジ日時 2024-05-22 23:49:56
合計ジャッジ時間 10,589 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
29,312 KB
testcase_01 AC 57 ms
29,312 KB
testcase_02 AC 51 ms
29,952 KB
testcase_03 AC 48 ms
29,568 KB
testcase_04 AC 46 ms
29,820 KB
testcase_05 AC 47 ms
29,440 KB
testcase_06 AC 48 ms
29,824 KB
testcase_07 AC 47 ms
29,800 KB
testcase_08 AC 48 ms
29,440 KB
testcase_09 AC 46 ms
29,824 KB
testcase_10 AC 48 ms
29,696 KB
testcase_11 AC 48 ms
29,184 KB
testcase_12 AC 47 ms
29,440 KB
testcase_13 AC 48 ms
29,824 KB
testcase_14 AC 46 ms
29,824 KB
testcase_15 AC 48 ms
29,312 KB
testcase_16 AC 47 ms
29,696 KB
testcase_17 AC 48 ms
29,440 KB
testcase_18 AC 48 ms
29,312 KB
testcase_19 AC 47 ms
29,560 KB
testcase_20 AC 171 ms
39,424 KB
testcase_21 AC 209 ms
43,520 KB
testcase_22 AC 210 ms
43,520 KB
testcase_23 AC 207 ms
43,896 KB
testcase_24 AC 205 ms
201,776 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (111 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

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 long[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => long.Parse(ReadLine())).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var t = NN;
        var ans = new long[t];
        var mod = 998_244_353;
        var rev25 = 319_438_193;
        for (var i = 0; i < t; ++i)
        {
            var l = long.Parse(ReadLine());
            ans[i] = 26 * (Exp(26, l, mod) - 1 + mod) % mod * rev25 % mod;
        }
        WriteLine(string.Join("\n", ans));
    }
    static long Exp(long n, long p, int mod)
    {
        long _n = n % mod;
        var _p = p;
        var result = 1L;
        if ((_p & 1) == 1) result *= _n;
        while (_p > 0)
        {
            _n = _n * _n % mod;
            _p >>= 1;
            if ((_p & 1) == 1) result = result * _n % mod;
        }
        return result;
    }
}
0