Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Last active November 5, 2019 08:50
Show Gist options
  • Save pinglunliao/df0f0bbc79dffb157f2f to your computer and use it in GitHub Desktop.
Save pinglunliao/df0f0bbc79dffb157f2f to your computer and use it in GitHub Desktop.
#include <cstdio>
using namespace std;
int main() {
float a,b,c,d,e,f;
while( scanf("%f%f%f%f%f%f",&a,&b,&c,&d,&e,&f) != EOF ){
float det = a*e - b * d;
float detX = c * e - b * f;
float detY = a * f - c * d;
if(det ==0 && detX ==0)
printf("Too many\n");
else if( det == 0)
printf("No answer\n");
else{
printf("x=%.2f\n",detX / det);
printf("y=%.2f\n",detY / det);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment