Cod sursa(job #2998453)
| Utilizator | Data | 9 martie 2023 15:44:49 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include <fstream>
using namespace std;
ifstream cin("arie.in");
ofstream cout("arie.out");
double arie;
struct punct{
int 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));
cout << arie/2.0;
return 0;
}
