Cod sursa(job #2973747)
| Utilizator | Data | 1 februarie 2023 20:12:27 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct punct{
long double x,y;
}v[100010];
int n;
long 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);
s/=2.0;
if (s < 0) {
s = -s;
}
fout<<setprecision(5)<<fixed<<s;
}
