2021-01-20 06:57:22 -05:00

37 lines
895 B
Java

import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
/* Type your code here. */
Scanner scnr = new Scanner(System.in);
int eq1Co1, eq1Co2, eq1Sol, eq2Co1, eq2Co2, eq2Sol;
int xSol, ySol;
boolean sol = false;
eq1Co1 = scnr.nextInt();
eq1Co2 = scnr.nextInt();
eq1Sol = scnr.nextInt();
eq2Co1 = scnr.nextInt();
eq2Co2 = scnr.nextInt();
eq2Sol = scnr.nextInt();
int x, y;
for(x= -10; x<10; x++){
if (sol==true){break;}
for(y= -10; y<10; y++){
if ( ((x*eq1Co1) + (y*eq1Co2) == eq1Sol) && ((x*eq2Co1) + (y*eq2Co2) == eq2Sol)){
xSol = x;
ySol = y;
System.out.println(""+xSol+" "+ySol);
sol=true;
}
}
}
if (sol==false){
System.out.println("No solution");
}
}
}