結果

問題 No.403 2^2^2
ユーザー yuppe19 😺
提出日時 2016-07-22 23:27:32
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 332 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 24,708 KB
最終ジャッジ日時 2024-11-06 09:24:00
合計ジャッジ時間 4,139 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python3
mod = 10**9 + 7

def f1(a, b, c):
    return pow(pow(a, b, mod), c, mod)

def f2(a, b, c):
    bc = b**c
    if bc >= mod - 1:
        return pow(a % mod, bc % (mod-1) + (mod-1), mod)
    else:
        return pow(a, bc, mod)

a, b, c = map(int, input().split('^'))
r1 = f1(a, b, c)
r2 = f2(a, b, c)
print(r1, r2)
0