Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. int N;
  7. cin >> N;
  8. int a[N][2];
  9. for(int i = 0; i<N; i++){
  10. cin >> a[i][0] >> a[i][1];
  11. }
  12. int ans = 0;
  13. for(int i=0; i<N-2; i++){// первая верщина
  14. for(int j = i+1; j<N-1; j++){
  15. for(int k = j+1; k<N; k++){
  16. int vx1, vy1, vx2, vy2, vx3, vy3;
  17. vx1 = a[j][0] - a[i][0];
  18. vy1 = a[j][1] - a[i][1];
  19. vx2 = a[j][0] - a[k][0];
  20. vy2 = a[j][1] - a[k][1];
  21. vx3 = a[k][0] - a[i][0];
  22. vy3 = a[k][1] - a[i][1];
  23. if(vx1*vx2 + vy1*vy2 == 0 || vx3*vx2 + vy3*vy2 == 0 || vx1*vx3 + vy1*vy3 == 0) ans++;
  24. }
  25. }
  26. }
  27. cout << ans;
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement