結果

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

ソースコード

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):
    if (c==1 and b>=mod-1) or (c>1 and b>=10**5):
        bcmod1 = pow(b, c, mod-1)
        return pow(a % mod, bcmod1 + (mod-1), mod)
    else:
        return pow(a, b**c, mod)

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