結果
問題 |
No.2007 Arbitrary Mod (Easy)
|
ユーザー |
|
提出日時 | 2023-04-23 10:48:29 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 796 bytes |
コンパイル時間 | 14,195 ms |
コンパイル使用メモリ | 164,788 KB |
実行使用メモリ | 183,988 KB |
最終ジャッジ日時 | 2024-11-07 18:40:22 |
合計ジャッジ時間 | 16,693 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 RE * 1 |
other | AC * 8 WA * 22 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (112 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/
ソースコード
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); } } }