結果

問題 No.1448 和差算
ユーザー roarisroaris
提出日時 2021-04-02 19:40:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 71,508 KB
最終ジャッジ日時 2023-08-25 03:50:00
合計ジャッジ時間 5,106 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,324 KB
testcase_01 AC 71 ms
71,420 KB
testcase_02 AC 72 ms
71,172 KB
testcase_03 AC 72 ms
71,352 KB
testcase_04 AC 73 ms
71,324 KB
testcase_05 AC 71 ms
71,500 KB
testcase_06 AC 71 ms
71,456 KB
testcase_07 AC 72 ms
71,220 KB
testcase_08 AC 73 ms
71,400 KB
testcase_09 AC 70 ms
71,500 KB
testcase_10 AC 71 ms
71,508 KB
testcase_11 AC 71 ms
71,264 KB
testcase_12 AC 71 ms
71,220 KB
testcase_13 AC 72 ms
71,280 KB
testcase_14 AC 73 ms
71,352 KB
testcase_15 AC 70 ms
70,968 KB
testcase_16 AC 71 ms
71,440 KB
testcase_17 AC 72 ms
71,016 KB
testcase_18 AC 72 ms
71,284 KB
testcase_19 AC 73 ms
71,268 KB
testcase_20 AC 71 ms
71,428 KB
testcase_21 AC 73 ms
71,408 KB
testcase_22 AC 71 ms
71,104 KB
testcase_23 AC 72 ms
71,408 KB
testcase_24 AC 72 ms
71,304 KB
testcase_25 AC 72 ms
71,412 KB
testcase_26 AC 72 ms
71,264 KB
testcase_27 AC 71 ms
71,028 KB
testcase_28 AC 72 ms
71,428 KB
testcase_29 AC 72 ms
71,360 KB
testcase_30 AC 75 ms
71,500 KB
testcase_31 AC 74 ms
71,416 KB
testcase_32 AC 72 ms
71,328 KB
testcase_33 AC 74 ms
71,412 KB
testcase_34 AC 74 ms
71,420 KB
testcase_35 AC 71 ms
71,228 KB
testcase_36 AC 71 ms
71,164 KB
testcase_37 AC 72 ms
71,304 KB
testcase_38 AC 72 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0