Skip to content

Instantly share code, notes, and snippets.

@mojaie
Created November 28, 2011 09:16
Show Gist options
  • Save mojaie/1399727 to your computer and use it in GitHub Desktop.
Save mojaie/1399727 to your computer and use it in GitHub Desktop.
AOJ:0004
import java.util.Scanner;
import java.text.DecimalFormat;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
while(scn.hasNext()) {
int a = scn.nextInt();
int b = scn.nextInt();
int p = scn.nextInt();
int c = scn.nextInt();
int d = scn.nextInt();
int q = scn.nextInt();
double delta = a * d - b * c;
double x = (d * p - b * q) / delta;
double y = (a * q - c * p) / delta;
String xstr = new DecimalFormat("###0.000").format(x);
String ystr = new DecimalFormat("###0.000").format(y);
System.out.println(xstr + " " + ystr);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment