Advertisement
Guest User

Untitled

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