結果

問題 No.2233 Average
ユーザー tktk_snsntktk_snsn
提出日時 2023-03-03 21:35:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 1,226 bytes
コンパイル時間 1,682 ms
コンパイル使用メモリ 81,552 KB
実行使用メモリ 80,096 KB
最終ジャッジ日時 2023-10-18 01:31:06
合計ジャッジ時間 4,163 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
73,460 KB
testcase_01 AC 76 ms
73,460 KB
testcase_02 AC 75 ms
73,460 KB
testcase_03 AC 74 ms
73,460 KB
testcase_04 AC 74 ms
73,460 KB
testcase_05 AC 74 ms
73,460 KB
testcase_06 AC 74 ms
73,460 KB
testcase_07 AC 91 ms
79,616 KB
testcase_08 AC 144 ms
80,036 KB
testcase_09 AC 167 ms
80,096 KB
testcase_10 AC 153 ms
80,008 KB
testcase_11 AC 149 ms
79,968 KB
testcase_12 AC 143 ms
79,952 KB
testcase_13 AC 115 ms
79,864 KB
testcase_14 AC 139 ms
80,036 KB
testcase_15 AC 151 ms
80,084 KB
testcase_16 AC 119 ms
79,992 KB
testcase_17 AC 124 ms
79,984 KB
testcase_18 AC 171 ms
80,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import os
import inspect
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 18

if os.getenv("TKTKLOCAL", False):
    def debug(*arg, sep=" ", end="\n"):
        print(*arg, sep=sep, end=end, file=sys.stderr)

    def debug_indent(*arg, sep=" ", end="\n", indent="    "):
        frame = inspect.currentframe().f_back
        par_func = inspect.getframeinfo(frame).function
        if par_func == "<module>":
            debug(*arg, sep=sep, end=end)
            return

        frame_stack = inspect.stack()
        if len(frame_stack) > 30:
            return

        depth = sum(f.function == par_func for f in frame_stack)
        debug(indent * (depth - 1), end="")
        debug(*arg, sep=sep, end=end)
else:
    def debug(*arg, **kwarg):
        pass

    def debug_indent(*arg, **kwarg):
        pass


def f(x, y):
    return (x + y) // 2


def solve():
    a, b, c, K = map(int, input().split())
    if a == b == c:
        print(3 * a)
        return

    for _ in range(K):
        na, nb, nc = f(b, c), f(a, c), f(a, b)
        if (a, b, c) == (na, nb, nc):
            break
        a, b, c = na, nb, nc
    print(a + b + c)


T = int(input())
for _ in range(T):
    solve()
0