結果

問題 No.1448 和差算
ユーザー rin204
提出日時 2022-01-18 05:06:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 298 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-11-23 13:15:25
合計ジャッジ時間 3,177 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

a, b, c, d = map(int, input().split())
n = int(input())
times = pow(16, n // 8, MOD)
n %= 8

max_ = -1 << 30
for xx in (a, b):
    for y in (c, d):
        x = xx
        for _ in range(n):
            x, y = x - y, x + y
        max_ = max(max_, x + y)
print(max_ * times % MOD)
0