結果

問題 No.966 引き算をして門松列(その1)
ユーザー vwxyzvwxyz
提出日時 2024-04-19 15:55:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 323 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-19 15:55:57
合計ジャッジ時間 1,243 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,752 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 86 ms
10,752 KB
testcase_06 AC 107 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
inf=1<<60
for t in range(T):
    A,B,C=map(int,input().split())
    s=0
    if A==C:
        s+=1
        C-=1
    if A>C:
        A,C=C,A
    ans=inf
    if A>=2:
        ans=min(ans,max(B-A+1,0)+s)
    if B>=3:
        ans=min(ans,max(A-B+2,0)+max(C-B+1,0)+s)
    if ans==inf:
        ans=-1
    print(ans)
0