Cod sursa(job #1548100)
| Utilizator | Data | 10 decembrie 2015 15:02:08 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
struct Punct{
double x,y;
};
int main()
{
int n;
double s = 0;
f>>n;
Punct P[n+1];
for(int i = 1 ; i<= n ; i++)
f>>P[i].x>>P[i].y;
P[++n] = P[1];
for(int i = 1 ; i < n ; i++)
s += (P[i].x*P[i+1].y - P[i+1].x*P[i].y);
g<<setprecision(5)<<fixed<<s/2.0;
return 0;
}
