結果

問題 No.966 引き算をして門松列(その1)
ユーザー komkompikomkompi
提出日時 2020-01-13 21:56:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 11,000 KB
実行使用メモリ 7,948 KB
最終ジャッジ日時 2023-08-24 16:27:28
合計ジャッジ時間 1,147 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,756 KB
testcase_01 AC 16 ms
7,772 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 84 ms
7,812 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)
                continue
            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