結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,760 KB
testcase_01 AC 16 ms
7,928 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:
            return 1
    else:
        cost = max(a, b, c) - b + 1
        if a != c:
            return cost
        else:
            return cost + 1

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


0