Cod sursa(job #2653985)
| Utilizator | Data | 29 septembrie 2020 17:18:55 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
long double arie;
void det(long double x1,long double y1,long double x2,long double y2)
{
arie += 0.5 * (x1*y2 - x2*y1);
}
int main()
{
long double x0,y0;
long double x1,x2,y1,y2;
int n;
f>>n;
f>>x0>>y0;
x1=x0;
y1=y0;
for(int i=2;i<=n;i++)
{
f>>x2>>y2;
det(x1,y1,x2,y2);
x1=x2,y1=y2;
}
det(x1,y1,x0,y0);
g<<setprecision(100)<<arie;
return 0;
}
