結果

問題 No.2110 012 Matching
ユーザー ThetaTheta
提出日時 2022-10-31 13:51:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 759 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 7,908 KB
最終ジャッジ日時 2023-09-22 11:16:54
合計ジャッジ時間 6,130 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,772 KB
testcase_01 AC 201 ms
7,852 KB
testcase_02 AC 504 ms
7,764 KB
testcase_03 AC 337 ms
7,776 KB
testcase_04 AC 669 ms
7,828 KB
testcase_05 AC 471 ms
7,824 KB
testcase_06 AC 456 ms
7,908 KB
testcase_07 AC 759 ms
7,852 KB
testcase_08 AC 40 ms
7,732 KB
testcase_09 AC 121 ms
7,832 KB
testcase_10 AC 756 ms
7,756 KB
testcase_11 AC 16 ms
7,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def best_choice(a: int, b: int, c: int) -> int:
    if b >= 2:
        return (b // 2)*2 + best_choice(a, b - (b//2)*2, c)

    if a > 0:
        if c > 0:
            return min(a, c) * 2 + best_choice(a-min(a, c), b, c-min(a, c))
        return min(a, b)

    return c // 2


def main():
    for _ in range(int(input())):
        A, B, C = map(int, input().split())
        print(best_choice(A, B, C))


if __name__ == "__main__":
    main()
0