結果

問題 No.966 引き算をして門松列(その1)
ユーザー KodaiKodai
提出日時 2020-04-30 11:01:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 747 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-08-21 09:00:31
合計ジャッジ時間 1,073 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 16 ms
7,872 KB
testcase_02 AC 15 ms
7,784 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 83 ms
7,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for i in range(T):
    A, B, C = list(map(int, input().split()))
    if A == B == C:
        print(3)
    elif A <= B <= C:
        ba = B - A + 1
        cb = C - B + 1
        if C - cb == A:
            cb += 1
        if B <= ba and C <= cb:
            print(-1)
        elif B <= ba:
            print(cb)
        elif C <= cb:
            print(ba)
        else:
            print(min([ba, cb]))
    elif C <= B <= A:
        bc = B - C + 1
        ab = A - B + 1
        if A - ab == C:
            ab += 1
        if B <= bc and A <= ab:
            print(-1)
        elif B <= bc:
            print(ab)
        elif A <= ab:
            print(bc)
        else:
            print(min([bc, ab]))
    else:
        print(0)
0