I tried to compare the last point with the first point with a very small error Epsilon ( I put 0.0000000000000001 ), and it was then giving WA :S :S :S
please help :S
- Code: Select all
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <climits>
using namespace std;
#ifndef ONLINE_JUDGE
#include <fstream>
#define cin in
ifstream in("10060.in");
#endif
struct point
{
double x, y;
point(){}
point(double X, double Y) : x(X), y(Y) {}
};
int main()
{
double TotalMass, pi=2*acos(0.0);
int nPloygon,Thikness;
cin >> nPloygon;
while( nPloygon != 0 && cin.good() )
{
TotalMass = 0;
int i;
for(i=0; i<nPloygon; i++)
{
cin>>Thikness;
double A = 0;
point p0,p_prev, p_curr(INT_MAX,INT_MAX);
cin>>p0.x>>p0.y;
p_prev = p0;
while( p_curr.x != p0.x || p_curr.y != p0.y)
{
cin>>p_curr.x>>p_curr.y;
A += p_prev.x * p_curr.y - p_curr.x * p_prev.y;
p_prev = p_curr ;
}
TotalMass += fabs( A/2*Thikness );
}
double R,T;
cin>>R>>T;
cout<< (int)( TotalMass/ ( R*R*T*pi ) )<<endl;
cin >> nPloygon;
}
return 0;
}


