結果
| 問題 |
No.2007 Arbitrary Mod (Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-23 10:58:47 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 833 bytes |
| コンパイル時間 | 11,792 ms |
| コンパイル使用メモリ | 167,580 KB |
| 実行使用メモリ | 186,420 KB |
| 最終ジャッジ日時 | 2024-11-07 18:49:30 |
| 合計ジャッジ時間 | 12,746 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (97 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(long.Parse).ToArray();
long a = input[0];
long 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(M);
Console.WriteLine(Math.Pow(a, c) % M);
}
}
}