結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー mobchanmobchan
提出日時 2023-04-23 10:48:29
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 796 bytes
コンパイル時間 7,919 ms
コンパイル使用メモリ 166,652 KB
実行使用メモリ 184,532 KB
最終ジャッジ日時 2024-04-25 08:15:26
合計ジャッジ時間 13,157 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
30,080 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 AC 48 ms
30,208 KB
testcase_04 AC 48 ms
30,208 KB
testcase_05 AC 48 ms
29,952 KB
testcase_06 AC 49 ms
30,080 KB
testcase_07 AC 48 ms
29,952 KB
testcase_08 AC 48 ms
30,208 KB
testcase_09 AC 47 ms
30,336 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 52 ms
30,208 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (85 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 System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int a = input[0];
        int b = input[1];
        long num = 1;
        int count = 0;
        int flag = 0;
        long M = 0;

        while (num < 10000001)
        {
            if (b-- == 0)
            {
                flag = 1;
                break;
            }
            num *= a;
            ++count;
        }

        if (flag == 1)
        {
            M = 10000000;
            Console.WriteLine(M);
            Console.WriteLine(num % M);
        }
        else
        {
            M = num - 1;
            var c = b % count;
            Console.WriteLine(Math.Pow(a, c) % M);
        }
    }
}
0