Cod sursa(job #2998458)
| Utilizator | Data | 9 martie 2023 15:50:04 | |
|---|---|---|---|
| Problema | Aria | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
ifstream cin("aria.in");
ofstream cout("aria.out");
double arie;
struct punct{
double x , y;
};
punct a , b;
int n;
int main()
{
cin >> n;
cin >> a.x >> a.y;
punct og;
og.x = a.x , og.y = a.y;
for(int i = 2 ; i <= n ;i++){
cin >> b.x >> b.y;
arie += ((a.x*b.y)-(a.y*b.x));
a = b;
}
arie += ((a.x*og.y)-(a.y*og.x));
arie = arie/2;
arie = abs(arie);
cout << fixed << setprecision(5) << arie;
return 0;
}
