-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaximize_colors.cpp
More file actions
43 lines (43 loc) · 864 Bytes
/
maximize_colors.cpp
File metadata and controls
43 lines (43 loc) · 864 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
34
35
36
37
38
39
40
41
42
43
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int a, b, c;
cin >> a >> b >> c;
vector<int> v = {a, b, c};
int cont = 0;
for (int i = 0; i < v.size(); i++)
{
if (v[i] > 0)
{
cont++;
v[i]--;
}
}
sort(v.begin(), v.end(), greater<int>());
if (v[0] > 0 && v[1] > 0)
{
cont++;
v[0]--;
v[1]--;
}
if (v[0] > 0 && v[2] > 0)
{
cont++;
v[0]--;
v[2]--;
}
if (v[1] > 0 && v[2] > 0)
{
cont++;
v[1]--;
v[2]--;
}
cout << cont << endl;
}
return 0;
}