Cod sursa(job #2973744)
Utilizator | Data | 1 februarie 2023 20:08:06 | |
---|---|---|---|
Problema | Aria | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct punct{
int x,y;
}v[100010];
int n;
double s;
int main(){
fin>>n;
for(int i=0;i<n;i++)
{fin>>v[i].x>>v[i].y;}
v[n]=v[0];
for(int i=0;i<n;i++)
s += (v[i].x*v[i+1].y-v[i].y*v[i+1].x);
fout<<fabs(s/2.0);
}