a
/解题报告:题目大意给出图的坐标求有多少可能掉进水里的弯道。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define LL long long
using namespace std;
struct node
{
int x,y;
}b[1005];
bool check(int i)
{
if(b[i].x<b[i+1].x && b[i+1].y<b[i+2].y)
return true;
else if(b[i].y>b[i+1].y &&b[i+1].x<b[i+2].x)
return true;
else if(b[i].x>b[i+1].x && b[i+1].y>b[i+2].y)
return true;
else if(b[i].y<b[i+1].y && b[i+1].x>b[i+2].x)
return true;
else return false;
}
int main()
{
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
{
scanf("%d%d",&b[i].x,&b[i].y);
}int ans=0;
for(int i=0;i<n-2;i++)
{
if(check(i))
ans++;
}
cout<<ans<<endl;
}
}