Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int N;
- cin >> N;
- int a[N][2];
- for(int i = 0; i<N; i++){
- cin >> a[i][0] >> a[i][1];
- }
- int ans = 0;
- for(int i=0; i<N-2; i++){// первая верщина
- for(int j = i+1; j<N-1; j++){
- for(int k = j+1; k<N; k++){
- int vx1, vy1, vx2, vy2, vx3, vy3;
- vx1 = a[j][0] - a[i][0];
- vy1 = a[j][1] - a[i][1];
- vx2 = a[j][0] - a[k][0];
- vy2 = a[j][1] - a[k][1];
- vx3 = a[k][0] - a[i][0];
- vy3 = a[k][1] - a[i][1];
- if( vx1*vx2 + vy1*vy2 == 0 || vx3*vx2 + vy3*vy2 == 0 || vx1*vx3 + vy1*vy3 == 0) ans++;
- }
- }
- }
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement