結果
問題 |
No.966 引き算をして門松列(その1)
|
ユーザー |
|
提出日時 | 2020-01-15 21:01:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,064 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 76,928 KB |
最終ジャッジ日時 | 2024-06-11 19:57:29 |
合計ジャッジ時間 | 1,116 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 WA * 3 |
ソースコード
T = int(input()) for _ in range(T): A, B, C = map(int, input().split()) if len(set([A, B, C]))==3 and (B==max(A, B, C) or B==min(A, B, C)): print(0) continue if (A>B and B>C) or (A>B and B==C): A, C = C, A if A<B and B<C: if A==1: if B==2: print(-1) elif B==A+1: print(C-(B-2)) else: print(C-(B-1)) else: if B==A+1: print(min(B-(A-1), C-(B-2))) else: print(min(B-(A-1), C-(B-1))) elif A==B and B<C: if A==1: print(-1) else: print(1) elif A==B==C: if A<=2: print(-1) else: print(3) elif B==max(A, B, C): if A==1: print(-1) else: print(1) elif B==min(A, B, C): if A==2: print(-1) else: if A==B+1: print(A-(B-1)+C-(B-2)) else: print(1)