結果
| 問題 |
No.1448 和差算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-01 00:42:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 873 bytes |
| コンパイル時間 | 239 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 846,180 KB |
| 最終ジャッジ日時 | 2024-12-15 23:59:30 |
| 合計ジャッジ時間 | 46,981 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 MLE * 1 |
| other | AC * 10 TLE * 2 MLE * 24 |
ソースコード
import sys, math
sys.setrecursionlimit(500005)
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
a, b, c, d = na()
n = ni()
f = n // 8
e = n % 8
def BiPower(a, b):
ans = 1
b = bin(b)[2:]
for i in range(1, len(b) + 1):
if b[-1 * i] == '1':
ans *= pow(a, 2 ** (i - 1))
return ans
def colc(a, b, c, d, i):
if i == 0:
return b + d
elif i == 1:
return 2 * b
elif i == 2:
return 2 * (b - c)
elif i == 3:
return -4 * c
elif i == 4:
return -4 * (a + c)
elif i == 5:
return -8 * a
elif i == 6:
return -8 * (a - d)
elif i == 7:
return 16 * d
ans = colc(a, b, c, d, e)
ans = (ans * BiPower(16, f)) % 1000000007
if ans < 0:
ans += 1000000007
print(ans)