Skip to content

Instantly share code, notes, and snippets.

@hhc0null
Created January 3, 2012 13:35
Show Gist options
  • Save hhc0null/1554900 to your computer and use it in GitHub Desktop.
Save hhc0null/1554900 to your computer and use it in GitHub Desktop.
aoj-0004-Simultaneous_Equation-ans.cpp
#include <cstdio>
#include <iomanip>
using namespace std;
int main(void) {
double a, b, c, d, e, f, x, y, tmp;
for(;scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) == 6;) {
tmp = a * e - b * d;
x = (c * e - b * f) / tmp + 0.0;
y = (a * f - c * d) / tmp + 0.0;
printf("%.3lf %.3lf\n", x, y);
}
return 0;
}
// i am a stupid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment