-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREACH_HOME (Difficulty-395).java
More file actions
37 lines (29 loc) · 990 Bytes
/
REACH_HOME (Difficulty-395).java
File metadata and controls
37 lines (29 loc) · 990 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
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner scanner = new Scanner(System.in);
// Read number of test cases
int T = scanner.nextInt();
// Process each test case
for (int i = 0; i < T; i++) {
// Read X and Y for the current test case
int X = scanner.nextInt(); // Litres of fuel
int Y = scanner.nextInt(); // Distance to home in km
// Calculate the maximum distance Chef can travel with the available fuel
int maxDistance = 5 * X;
// Determine if Chef can reach home
if (maxDistance >= Y) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
// Close the scanner
scanner.close();
}
}