Cod sursa(job #2648466)
Utilizator | Data | 11 septembrie 2020 00:28:21 | |
---|---|---|---|
Problema | Aria | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f ( "aria.in" );
ofstream g ( "aria.out" );
struct punct
{
int x, y;
};
int main()
{
punct pr, a, b;
double arie = 0;
int n;
f >> n;
f >> pr.x >> pr.y;
a = pr;
for ( int i = 2; i <= n; i++ )
{
f >> b.x >> b.y;
arie += ( 1LL*a.x * b.y - 1LL*a.y * b.x );
a = b;
}
arie += (1LL*pr.y * b.x - 1LL*pr.x * b.y);
g << setprecision(5)<<arie/2.0;
return 0;
}