Pagini recente » Cod sursa (job #2718887) | Cod sursa (job #456159) | Cod sursa (job #2258978) | Cod sursa (job #2516558) | Cod sursa (job #2299292)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("aria.in");
ofstream fout ("aria.out");
int n,i,a.s;
struct punct{
double x,y;
}v[1000];
int c_p(punct a, punct o, punct b)
{
int d=( a.x - o.x ) * ( b.y - o.y ) - ( b.x - o.y) * ( a.y - o.y );
if(d==0)return 1;
else if(d<0)return 2;
else if(d>0)return 3;
}
int main()
{
cin>>n;
for(i=1;i<=n;i++)
{
cin>>v[i].x>>v[i].y;
}
p.x=0;
p.y=0;
for(i=1;i<=n;i++)
{
a=c_p(v[i],p,v[i+1])/2;
s=s+a;
}
return 0;
}