結果
| 問題 | No.1448 和差算 |
| コンテスト | |
| ユーザー |
tamato
|
| 提出日時 | 2021-03-31 16:23:30 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 34 ms / 2,000 ms |
| + 60µs | |
| コード長 | 460 bytes |
| 記録 | |
| コンパイル時間 | 114 ms |
| コンパイル使用メモリ | 64,884 KB |
| 実行使用メモリ | 53,948 KB |
| 最終ジャッジ日時 | 2026-10-17 10:31:33 |
| 合計ジャッジ時間 | 3,377 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
mod = 1000000007
eps = 10**-9
def main():
import sys
input = sys.stdin.readline
a, b, c, d = map(int, input().split())
N = int(input())
x = y = pow(2, (N+1) // 2, mod)
if 0 <= N%8 < 3:
x *= b
elif 4 <= N%8 < 7:
x *= -a
else:
x = 0
if N%8 == 0 or 6 <= N%8:
y *= d
elif 2 <= N%8 <= 4:
y *= -c
else:
y = 0
print((x + y)%mod)
if __name__ == '__main__':
main()
tamato