結果

問題 No.966 引き算をして門松列(その1)
ユーザー AzumabashiAzumabashi
提出日時 2020-05-02 11:41:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 8,024 KB
最終ジャッジ日時 2023-08-28 13:08:14
合計ジャッジ時間 1,513 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def main():
    queries = int(input())
    for _ in range(queries):
        a, b, c = map(int, input().split())
        if a == b == c:
            print(3)
        elif a == b < c or a > b == c:
            print(1)
        elif a == b > c or a < b == c:
            if b == c + 1 or a + 1 == b:
                print(2)
            else:
                print(1)
        elif a < b < c or c < b < a:
            diff = min(abs(b - a), abs(c - b)) + 1
            b -= diff
            print(diff if b > 0 else -1)
        elif max(a, b, c) == b or min(a, b, c) == b:
            print(0)


if __name__ == '__main__':
    main()

0