結果
| 問題 |
No.966 引き算をして門松列(その1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-21 00:33:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 884 bytes |
| コンパイル時間 | 612 ms |
| コンパイル使用メモリ | 67,260 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-06 09:40:54 |
| 合計ジャッジ時間 | 1,134 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 5 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int t, i, j, k, ans;
int main(){
cin >> t;
long long a[t], b[t], c[t];
for(i = 0; i < t; i++) cin >> a[i] >> b[i] >> c[i];
for(i = 0; i < t; i++){
ans = 0;
if(a[i] == c[i]) {ans += 1; a[i] -= 1;}
if(a[i] == 0){ans = -1;}
if(a[i] < b[i] && c[i] > b[i]){
if(b[i] <= 2) ans = -1;
else{
ans = min(b[i] - a[i], c[i] - b[i]) + 1;
}
}
if(a[i] == b[i] || b[i] == c[i]){
if(a[i] == b[i]){
if(a[i] == 1) ans = -1;
else ans += 1;
}
if(c[i] == b[i]){
if(b[i] <= 2) ans = -1;
else if(b[i] - a[i] == 1) ans += 3;
else ans += 2;
}
}
cout << ans << endl;
}
return 0;
}