結果

問題 No.1448 和差算
ユーザー tamatotamato
提出日時 2021-03-31 16:21:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 71,624 KB
最終ジャッジ日時 2023-08-21 14:50:30
合計ジャッジ時間 5,419 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,192 KB
testcase_01 AC 72 ms
71,624 KB
testcase_02 AC 73 ms
71,324 KB
testcase_03 AC 73 ms
71,116 KB
testcase_04 AC 72 ms
71,336 KB
testcase_05 AC 71 ms
71,044 KB
testcase_06 WA -
testcase_07 AC 71 ms
71,340 KB
testcase_08 AC 71 ms
71,524 KB
testcase_09 WA -
testcase_10 AC 71 ms
71,324 KB
testcase_11 AC 71 ms
71,472 KB
testcase_12 AC 71 ms
71,496 KB
testcase_13 AC 75 ms
71,328 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 72 ms
71,328 KB
testcase_18 WA -
testcase_19 AC 72 ms
71,308 KB
testcase_20 AC 71 ms
71,328 KB
testcase_21 AC 71 ms
71,508 KB
testcase_22 AC 70 ms
71,100 KB
testcase_23 AC 72 ms
71,284 KB
testcase_24 AC 71 ms
71,536 KB
testcase_25 AC 71 ms
71,524 KB
testcase_26 AC 71 ms
71,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 70 ms
71,372 KB
testcase_32 AC 72 ms
71,444 KB
testcase_33 WA -
testcase_34 AC 70 ms
71,520 KB
testcase_35 AC 69 ms
71,380 KB
testcase_36 AC 70 ms
71,444 KB
testcase_37 AC 70 ms
71,376 KB
testcase_38 AC 71 ms
71,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 < 4:
        x *= b
    elif 5 <= N%8:
        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()
0