結果

問題 No.966 引き算をして門松列(その1)
ユーザー komkompi
提出日時 2020-01-13 21:53:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-23 00:29:07
合計ジャッジ時間 1,115 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 1 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for _ in range(N):
    A,B,C=map(int,input().split())
    
    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