Cod sursa(job #3004006)
| Utilizator | Data | 16 martie 2023 08:34:33 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("arie.in");
ofstream g("arie.out");
double arie;
struct punct
{
double x , y;
}a , b , first;
int n;
int main()
{
f >> n;
f >> a . x >> a . y;
first = a;
for ( int i = 2 ; i <= n ; i++)
{
f >> b . x >> b . y;
arie = arie + (( a . x * b . y) - (a . y * b . x));
a = b;
}
arie = arie + ( ( a . x * first . y) - (a . y * first . x));
arie = arie / 2;
g << fixed << setprecision(5) << arie;
return 0;
}
