forked from wafarifki/Hacktoberfest_2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAirlineRestrictions.cpp
51 lines (48 loc) · 973 Bytes
/
AirlineRestrictions.cpp
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
#include<iostream>
#include<vector>
using namespace std;
int main(){
int t;
cin>>t;
int a,b,c,d,e;
for(int i=0;i<t;i++){
cin>>a>>b>>c>>d>>e;
vector<int> arr;
arr.push_back(a+b);
arr.push_back(b+c);
arr.push_back(c+a);
int tempIndex=-1;
int max=0;
for(int i=0;i<arr.size();i++){
if(arr[i]<=d && arr[i]>max){
max=arr[i];
tempIndex=i;
}
}
if(tempIndex==0)
{
if(c<=e){
cout<<"YES";
}
else
cout<<"NO";
}
else if(tempIndex==1)
{
if(a<=e){
cout<<"YES";
}
else
cout<<"NO";
}
else if(tempIndex==2)
{
if(b<=e){
cout<<"YES";
}
else
cout<<"NO";
}
}
return 0;
}