-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAirline.java
More file actions
61 lines (48 loc) · 1.41 KB
/
Airline.java
File metadata and controls
61 lines (48 loc) · 1.41 KB
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
58
59
60
61
/*
* Chef has 3 bags that she wants to take on a flight. They weigh A, B, and C kgs respectively.
* She wants to check-in exactly two of these bags and carry the remaining one bag with her.
The airline restrictions says that the total sum of the weights of the bags that are checked-in cannot exceed D kgs and
the weight of the bag which is carried cannot exceed E kgs. Find if Chef can take all the three bags on the flight.
*
*
*
*/
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Airline
{
public static void carried(int a,int b,int c,int d,int e)
{
if(a>=0&&a<=10&&b>=0&&b<=10&&c>=0&&c<=10&&d>=15&&d<=20&&e>=5&&e<=10)
{
int n1=a+b;
int n2=b+c;
int n3=a+c;
if(n1<d&&n2<d&&n3<d||a<e||b<e||c<e)
{
System.out.print("YES");
}
else {
System.out.print("No");
}
}
}
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner input=new Scanner(System.in);
int T =input.nextInt();
while(T-- > 0)
{
int a=input.nextInt();
int b=input.nextInt();
int c=input.nextInt();
int d=input.nextInt();
int e=input.nextInt();
carried(a,b,c,d,e);
}
}
}