結果

問題 No.966 引き算をして門松列(その1)
ユーザー komkompikomkompi
提出日時 2020-01-13 21:56:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 8,168 KB
最終ジャッジ日時 2023-08-24 16:26:33
合計ジャッジ時間 1,148 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

# coding: utf-8
# Your code here!
N=int(input())

for _ in range(N):
    A,B,C=map(int,input().split())
    
    if A==B and B==C:
        if A>2:
            print(3)
        else:
            print(-1)
        continue
    
    ans=0
    if (B>A and B>C) or (B<A and B<C):
        if A==C:
            if A==1:
                print(-1)
                exit()
            else:
                ans+=1
        print(ans)
    else:
        if B<3 or (A==1 and C==1):
            print(-1)
        else:
            mx=B-1
            mi=min(A,C)-1
            print(min(max(A,C)-mx,B-mi))
        
0