Question: Java15: import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList;
Java15:

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
class Result {
/*
* Complete the 'isPossible' function below.
*
* The function is expected to return a STRING.
* The function accepts following parameters:
* 1. INTEGER a
* 2. INTEGER b
* 3. INTEGER c
* 4. INTEGER d
*/
public static String isPossible(int a, int b, int c, int d) {
}
}
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
int a = Integer.parseInt(bufferedReader.readLine().trim());
int b = Integer.parseInt(bufferedReader.readLine().trim());
int c = Integer.parseInt(bufferedReader.readLine().trim());
int d = Integer.parseInt(bufferedReader.readLine().trim());
String result = Result.isPossible(a, b, c, d);
bufferedWriter.write(result);
bufferedWriter.newLine();
bufferedReader.close();
bufferedWriter.close();
}
}
Consider a pair of integers, (a, b). The following operations can be performed on (a, b) in any order, zero or more times: (a, b) = (a + b, b) (a, b) (a, a + b) Return a string that denotes whether or not (a, b) can be converted to to (c, d) by by performing zero or more of the operations specified above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
