-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC.cpp
More file actions
33 lines (28 loc) · 736 Bytes
/
Copy pathC.cpp
File metadata and controls
33 lines (28 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(),v.end()
#define X first
#define Y second
#define rep(x, y, z) for(ll (z) = (x); (z) < (y); (z)++)
int constexpr N = 1e5;
int constexpr MOD = 1e9 + 7;
int constexpr INF = 1e9;
int main() {
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int tc;
cin >> tc;
while (tc--) {
int c, m, x;
cin >> c >> m >> x;
ll sum = c + m + x;
int cntm = min({c, m, x});
sum -= 3 * cntm;
c -= cntm;
m -= cntm;
x -= cntm;
if (c == 0 || m == 0) cout << cntm << '\n';
else cout << cntm + (sum / 3 > min(c, m) ? min(c, m) : sum / 3) << '\n';
}
return 0;
}