Pagini recente » Borderou de evaluare (job #2855762) | Borderou de evaluare (job #3225654) | Diferente pentru problema/dlog intre reviziile 4 si 2 | Borderou de evaluare (job #1319065) | Cod sursa (job #1504100)
#include <fstream>
#include <vector>
using namespace std;
ifstream is("aria.in");
ofstream os("aria.out");
struct Punct{
double x, y;
} in, a, b;
int n;
double s;
int Aria(Punct A, Punct B);
int main()
{
is >> n;
is >> a.x >> a.y;
in.x = a.x; in.y = a.y;
for ( int i = 2; i <= n; ++i )
{
is >> b.x >> b.y;
s += Aria(a, b);
a = b;
}
s += Aria(a, in);
os << s;
is.close();
os.close();
return 0;
}
int Aria(Punct A, Punct B)
{
return ( A.x * B.y - A.y * B.x ) / 2;
}