Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <algorithm>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. bool isok(double x1, double y1, double x2, double y2, double x3, double y3) {
  9. if (((x1-x2)*(x3-x2)+(y1-y2)*(y3-y2))==0) return true;
  10. else return false;
  11. }
  12.  
  13. int main()
  14. {
  15. double a1,a2,a3,a4,b1,b2,b3,b4;
  16. int ans=0;
  17. cin >> a1 >> b1 >> a2 >> b2 >> a3 >> b3 >> a4 >> b4;
  18. if (isok(a1,b1,a2,b2,a3,b3)) ans++;
  19. if (isok(a2,b2,a3,b3,a4,b4)) ans++;
  20. if (isok(a3,b3,a4,b4,a1,b1)) ans++;
  21. if (isok(a4,b4,a1,b1,a2,b2)) ans++;
  22. cout << ans;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement