Cod sursa(job #2489225)
| Utilizator | Data | 8 noiembrie 2019 09:23:04 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-32 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
int N;
long double aria=0;
struct poz
{
long double x;
long double y;
} v[1000015];
ifstream fin ("aria.in");
ofstream fout ("aria.out");
int main()
{
fin>>N;
for (int i=1; i<=N; i++)
fin>>v[i].x>>v[i].y;
v[N+1]=v[1];
for(int i=1; i<=N; i++)
aria+=(v[i].x)*(v[i+1].y)-(v[i+1].x)*(v[i].y);
fout<<setprecision(5)<<fixed<<abs(aria/2.0);
}
