Cod sursa(job #3202018)
| Utilizator | Data | 10 februarie 2024 12:55:26 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <fstream>
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int main()
{
int n;
fin>>n;
long double x1,y1;
fin>>x1>>y1;
long double x0=x1,y0=y1;
long double arie=0;
for (int i=2; i<=n; i++)
{
long double x2,y2;
fin>>x2>>y2;
arie += (x1 * y2 - x2 * y1) / 2.0;
if (i==n)
arie=arie+(x2 * y0 - x0 * y2)/2.0;
x1=x2;
y1=y2;
}
fout<<setprecision(10)<<fixed<< arie;
return 0;
}
