Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Numbers {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int caseA = scanner.nextInt();
- int caseB = scanner.nextInt();
- int caseA2B = scanner.nextInt();
- int caseAB2 = scanner.nextInt();
- for (int a = -1000; a <= 1000; a++) {
- for (int b = -1000; b <= 1000; b++) {
- if (a == 0 || b == 0) {
- continue;
- }
- if ((a == caseA || caseA == 0) &&
- (b == caseB || caseB == 0) &&
- (a * a * b == caseA2B || caseA2B == 0) &&
- (a * b * b == caseAB2 || caseAB2 == 0)) {
- System.out.println(a + " " + b + " " + (a * a * b) + " " + (a * b * b));
- return;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement