forked from 0xNilesh/Solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fast_Food_Restaurant
57 lines (56 loc) · 1.12 KB
/
Fast_Food_Restaurant
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int a,b,c,sum=0;
cin>>a>>b>>c;
vector<int> v;
v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(),v.end());
if(v[0]>=4)
{
cout<<"7"<<"\n";
continue;
}
v.erase(remove(v.begin(),v.end(),0),v.end());
sum+=v.size();
for(int i=0;i<v.size();i++)
v[i]-=1;
v.erase(remove(v.begin(),v.end(),0),v.end());
if(v.size()==1 || v.size()==0)
{
cout<<sum<<"\n";
continue;
}
if(v.size()==2)
{
cout<<sum+1<<"\n";
continue;
}
if(v[0]==1)
{
if(v[2]==1)
{
cout<<sum+1<<"\n";
continue;
}
else
{
cout<<sum+2<<"\n";
continue;
}
}
if(v[0]==2)
{
sum+=3;
cout<<sum<<"\n";
continue;
}
}
}