結果
問題 | No.1448 和差算 |
ユーザー |
|
提出日時 | 2021-04-02 19:40:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 376 bytes |
コンパイル時間 | 281 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 52,224 KB |
最終ジャッジ日時 | 2024-12-23 15:58:30 |
合計ジャッジ時間 | 2,544 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 |
ソースコード
A, B, C, D = map(int, input().split()) N = int(input()) MOD = 10**9+7 p = pow(16, N//8, MOD) if N%8==0: print(p*(B+D)%MOD) elif N%8==1: print((2*p*B)%MOD) elif N%8==2: print(2*p*(B-C)%MOD) elif N%8==3: print(-4*p*C%MOD) elif N%8==4: print(-4*p*(A+C)%MOD) elif N%8==5: print(-8*p*A%MOD) elif N%8==6: print(8*p*(D-A)%MOD) else: print(16*p*D%MOD)