Cod sursa(job #1153737)
Utilizator | Data | 25 martie 2014 18:02:04 | |
---|---|---|---|
Problema | Aria | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
long double aria;
struct {long double x,y;} p,last_p,first_p;
int n;
int main()
{
f>>n;
f>>last_p.x>>last_p.y;
first_p=last_p;
for(--n;n;--n)
{
f>>p.x>>p.y;
aria+=last_p.x*p.y-p.x*last_p.y;
last_p=p;
}
p=first_p;
aria+=last_p.x*p.y-p.x*last_p.y;
g<<aria/2;
return 0;
}