結果
問題 | No.2007 Arbitrary Mod (Easy) |
ユーザー |
![]() |
提出日時 | 2022-07-15 22:28:04 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 744 bytes |
コンパイル時間 | 4,632 ms |
コンパイル使用メモリ | 107,544 KB |
実行使用メモリ | 26,120 KB |
最終ジャッジ日時 | 2024-06-27 19:05:18 |
合計ジャッジ時間 | 8,005 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;public class Hello{static void Main(){string[] line = Console.ReadLine().Trim().Split(' ');var a = long.Parse(line[0]);var n = long.Parse(line[1]);getAns(a, n);}static void getAns(long a, long n){var m = 10000000;var b = new long[61];b[0] = a % m;for (int i = 1; i <= 60; i++){b[i] = b[i - 1] * b[i - 1];b[i] %= m;}var ans = 1L;for (int i = 0; i <= 60; i++){if (((n >> i) & 1) == 1){ans *= b[i];ans %= m;}}Console.WriteLine(m);Console.WriteLine(ans);}}