結果

問題 No.1448 和差算
ユーザー lemonlemon
提出日時 2021-04-01 00:47:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 722 bytes
コンパイル時間 1,348 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 71,424 KB
最終ジャッジ日時 2023-08-22 05:39:20
合計ジャッジ時間 5,683 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,128 KB
testcase_01 AC 70 ms
71,100 KB
testcase_02 AC 71 ms
71,164 KB
testcase_03 AC 70 ms
71,096 KB
testcase_04 AC 68 ms
71,424 KB
testcase_05 AC 71 ms
71,144 KB
testcase_06 AC 70 ms
71,320 KB
testcase_07 AC 70 ms
71,228 KB
testcase_08 AC 70 ms
71,416 KB
testcase_09 AC 69 ms
71,320 KB
testcase_10 AC 70 ms
71,012 KB
testcase_11 AC 70 ms
70,876 KB
testcase_12 AC 69 ms
71,396 KB
testcase_13 AC 73 ms
71,156 KB
testcase_14 AC 74 ms
71,016 KB
testcase_15 AC 72 ms
71,064 KB
testcase_16 AC 71 ms
71,072 KB
testcase_17 AC 70 ms
71,136 KB
testcase_18 AC 72 ms
71,172 KB
testcase_19 AC 71 ms
71,396 KB
testcase_20 AC 71 ms
71,400 KB
testcase_21 AC 72 ms
71,356 KB
testcase_22 AC 72 ms
71,224 KB
testcase_23 AC 73 ms
70,892 KB
testcase_24 AC 71 ms
71,100 KB
testcase_25 AC 72 ms
71,224 KB
testcase_26 AC 74 ms
71,180 KB
testcase_27 AC 74 ms
71,212 KB
testcase_28 AC 72 ms
70,900 KB
testcase_29 AC 73 ms
70,888 KB
testcase_30 AC 72 ms
71,044 KB
testcase_31 AC 71 ms
71,164 KB
testcase_32 AC 74 ms
71,100 KB
testcase_33 AC 73 ms
71,416 KB
testcase_34 AC 72 ms
70,884 KB
testcase_35 AC 73 ms
71,016 KB
testcase_36 AC 74 ms
71,108 KB
testcase_37 AC 74 ms
71,024 KB
testcase_38 AC 74 ms
71,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 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 % 1000000007 * pow(16, f, 1000000007))  % 1000000007

if ans < 0:
    ans += 1000000007

print(ans)
0