結果

問題 No.1578 A × B × C
ユーザー FromBooskaFromBooska
提出日時 2023-06-18 19:47:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 1,315 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 71,372 KB
最終ジャッジ日時 2023-09-08 15:52:43
合計ジャッジ時間 3,637 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,212 KB
testcase_01 AC 72 ms
71,172 KB
testcase_02 AC 73 ms
71,176 KB
testcase_03 AC 73 ms
71,108 KB
testcase_04 AC 72 ms
70,928 KB
testcase_05 AC 72 ms
71,128 KB
testcase_06 AC 72 ms
70,964 KB
testcase_07 AC 72 ms
71,324 KB
testcase_08 AC 72 ms
71,136 KB
testcase_09 AC 71 ms
71,204 KB
testcase_10 AC 70 ms
71,064 KB
testcase_11 AC 72 ms
71,268 KB
testcase_12 AC 73 ms
71,276 KB
testcase_13 AC 72 ms
71,032 KB
testcase_14 AC 73 ms
70,928 KB
testcase_15 AC 72 ms
71,260 KB
testcase_16 AC 72 ms
71,084 KB
testcase_17 AC 72 ms
71,080 KB
testcase_18 AC 71 ms
71,276 KB
testcase_19 AC 73 ms
71,076 KB
testcase_20 AC 72 ms
71,172 KB
testcase_21 AC 73 ms
71,020 KB
testcase_22 AC 73 ms
71,372 KB
testcase_23 AC 71 ms
71,340 KB
testcase_24 AC 73 ms
71,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# ABC228E
# フェルマーの小定理
# https://manabitimes.jp/math/680
# M**(K**N) mod p
# K**N = (p-1)*q + r
# r = K**N mod (p-1)
# M**(K**N) mod p = M**((p-1)*q+r) = 1*M**r mod p

A, B, C = map(int, input().split())
K = int(input())
mod = 10**9+7
ABC = (A*B*C)%mod
r = pow(2, K, mod-1)
ans = pow(ABC, r, mod)
print(ans)
0