提出 #39672115
ソースコード 拡げる
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
typedef long long ll;
using namespace std;
int a[4];
int main() {
#ifdef DEBUG
freopen("1.in", "r", stdin);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin >> T;
while(T--) {
cin >> a[1] >> a[2] >> a[3];
sort(a + 1, a + 4);
int x = a[2] - a[1], y = a[3] - a[2];
if((x % 2) || (y % 2)) {
cout << "-1\n";
continue;
}
if(x > y) {
swap(x, y);
}
x /= 2, y /= 2;
int ans = x;
y -= x;
if(y % 3) {
cout << "-1\n";
continue;
}
ans += y / 3 * 2;
cout << ans << '\n';
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - +3 +5 +7 |
| ユーザ | yanchengzhi |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 300 |
| コード長 | 693 Byte |
| 結果 | AC |
| 実行時間 | 72 ms |
| メモリ | 3608 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 01_sample_01.txt |
| All | 01_sample_01.txt, 02_test_a_01.txt, 02_test_a_02.txt, 03_test_b_01.txt, 03_test_b_02.txt, 04_test_c_01.txt, 04_test_c_02.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01_sample_01.txt | AC | 4 ms | 3496 KiB |
| 02_test_a_01.txt | AC | 69 ms | 3544 KiB |
| 02_test_a_02.txt | AC | 68 ms | 3544 KiB |
| 03_test_b_01.txt | AC | 65 ms | 3608 KiB |
| 03_test_b_02.txt | AC | 64 ms | 3500 KiB |
| 04_test_c_01.txt | AC | 72 ms | 3540 KiB |
| 04_test_c_02.txt | AC | 72 ms | 3444 KiB |