結果

問題 No.966 引き算をして門松列(その1)
ユーザー ak0327ak0327
提出日時 2020-09-23 20:22:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 7,952 KB
最終ジャッジ日時 2023-09-10 11:01:22
合計ジャッジ時間 1,091 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def kadomastu(a,b,c):
    if b <= 2:
        return -1
    elif a == b == c:
        return 3
    elif max(a, b, c) == b:
        if a != c:
            return 0
        else:
            if a == 1:
                return -1
            else:
                return 1
    else:
        cost = max(a, b, c) - b + 1
        if a != c:
            return cost
        else:
            if a == 1:
                return -1
            else:
                return cost + 1


n = int(input())

for _ in range(n):
    a, b, c = map(int, input().split())
    print(kadomastu(a, b, c))





0