結果

問題 No.966 引き算をして門松列(その1)
コンテスト
ユーザー komkompi
提出日時 2020-01-13 21:56:20
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 597 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 58 ms
コンパイル使用メモリ 14,848 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-10-06 06:13:57
合計ジャッジ時間 1,827 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# 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