Cod sursa(job #2088659)

Utilizator Steve_ITStefan Ursache Steve_IT Data 15 decembrie 2017 17:30:46
Problema Aria Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.43 kb
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
struct stefan {
    double a, b;
};
double t;
int n, i;
stefan x, y, o;
int main()
{
    f>>n>>x.a>>x.b; o=x;
    for(i=2; i<=n; i++) {
        f>>y.a>>y.b;
        t+=x.a*y.b-y.a*x.b;
        x=y;
    }
    t+=x.a*o.b-x.b*o.a;
    g<<setprecision(6)<<fixed<<t/2;
    f.close();
    g.close();
    return 0;
}