Cod sursa(job #2489221)
| Utilizator | Data | 8 noiembrie 2019 09:19:57 | |
|---|---|---|---|
| Problema | Aria | Scor | 90 |
| 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
{
double long x;
double long y;
} v[100001];
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);
}
