Advertisement
GerONSo

Untitled

Jul 12th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. pt q, w, e;
  2. cin >> q >> w >> e;
  3. w = w - q;
  4. int a = w.x;
  5. int b = w.y;
  6. int k = e.x;
  7. int t = e.y;
  8. int x, y;
  9. if(k == 0 && t == 0) {
  10. if(a == 0 && b == 0) {
  11. return cout << "YES", 0;
  12. }
  13. else {
  14. return cout << "NO", 0;
  15. }
  16. }
  17. else if(k == 0) {
  18. if(a % t == 0 && b % t == 0) {
  19. return cout << "YES", 0;
  20. }
  21. return cout << "NO", 0;
  22. }
  23. else if(t == 0) {
  24. if(a % k == 0 && b % k == 0) {
  25. return cout << "YES", 0;
  26. }
  27. return cout << "NO", 0;
  28. }
  29. else {
  30. y = (k * b - t * a) / (k * k + t * t);
  31. x = (a + t * y) / k;
  32. }
  33. if(k * x + t * y == a && t * x - k * y == b) {
  34. cout << "YES";
  35. }
  36. else {
  37. cout << "NO";
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement