Pagini recente » Cod sursa (job #3341613) | Cod sursa (job #3355193) | Cod sursa (job #3335556) | Cod sursa (job #3339173) | Cod sursa (job #3354665)
#include <fstream>
#include <iostream>
#include <algorithm>
struct pct
{
int p;
double x, y;
};
bool abc(pct x, pct y)
{
if(x.x < y.x) return 1;
else if(x.x == y.x && x.y < y.y) return 1;
return 0;
}
int main()
{
int n, i, s1[120001], s2[120001], k1 = 0, k2 = 0;
pct z[120001];
std::ifstream fi("infasuratoare.in");
std::ofstream fo("infasuratoare.out");
fi >> n;
for(i = 0; i < n; i++) fi >> z[i].x >> z[i].y;
std::sort(z, z + n, abc);
pct a = z[0], b = z[n - 1];
for(i = 0 ; i < n; i++)
{
pct c = z[i];
int arie = a.x*b.y + b.x*c.y + c.x*a.y -b.y*c.x -c.y*a.x - a.y*b.x;
if(arie > 0) z[i].p = 0;
else if(arie < 0) z[i].p = 1;
else z.p = 2;
}
for(i = 0; i < n; i++)
{
if(z.p == 1);
}
}