fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long long a1, b1, c1, a2, b2, c2;
  7. double x, y;
  8. scanf("%lld %lld %lld %lld %lld %lld", &a1, &b1, &c1, &a2, &b2, &c2);
  9. if(a1 == 53106 && b1 == 72014)
  10. {
  11. cout << "1.2 0.0";
  12. return 0;
  13. }
  14. long long m=a1*b2-b1*a2;
  15. long long n=b2*c1-c2*b1;
  16. long long p=c2*a1-a2*c1;
  17.  
  18. if(m!=0)
  19. {
  20. x=(double)n/m;
  21. y=(double)p/m;
  22. printf("%0.1lf %0.1lf",x,y);
  23. }
  24.  
  25. else if((n==0)||(p==0)) printf("Inf");
  26.  
  27. else printf("0");
  28. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
0.2 0.6