fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. /*bool poh(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
  5. {
  6. double Ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1));
  7. if (Ua >= 0 && Ua <= 1)
  8. {
  9. return true;
  10. }
  11. }*/
  12.  
  13. double poh(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
  14. {
  15. double Ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1));
  16. cout << x1 << y4;
  17. cout << Ua;
  18. }
  19.  
  20. int main() {
  21. int a[2][2];
  22. for (int i = 0; i < 2; ++i) {
  23. cin >> a[i][0];
  24. cin >> a[i][1];
  25. }
  26. int b[2][2];
  27. for (int i = 0; i < 2; ++i) {
  28. cin >> b[i][0];
  29. cin >> b[i][1];
  30. }
  31.  
  32. /*if (poh(a[0][0], a[0][1], a[1][0], a[1][1], b[0][0], b[0][1], b[1][0], b[1][1]) == true){
  33. cout << 1;
  34. }
  35. else {
  36. cout << 0;
  37. }*/
  38.  
  39.  
  40. }
Success #stdin #stdout 0s 3460KB
stdin
2 2 6 5 4 2 2 5
stdout
Standard output is empty