結果
問題 | No.1578 A × B × C |
ユーザー |
|
提出日時 | 2021-07-02 22:50:13 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 684 bytes |
コンパイル時間 | 2,975 ms |
コンパイル使用メモリ | 109,732 KB |
実行使用メモリ | 27,284 KB |
最終ジャッジ日時 | 2024-06-29 12:42:02 |
合計ジャッジ時間 | 4,541 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Collections.Generic;using static System.Console;using System.Linq;class yuki302{static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();static void Main(){var c = NList;var k = long.Parse(ReadLine());var key = 1000000007;WriteLine(Exp((c[0] * c[1] % key) * c[2] % key, Exp(2, k, key - 1), key));}static long Exp(long n, long k, int keyNum){if (k == 0) return 1;if (k == 1) return n % keyNum;var half = Exp(n, k / 2, keyNum);var result = (half * half) % keyNum;return ((k % 2) == 0) ? result : ((result * n) % keyNum);}}