Cod sursa(job #3316666)

Utilizator LSSPLYAntochi Alessio LSSPLY Data 19 octombrie 2025 18:15:36
Problema Aria Scor 70
Compilator c-64 Status done
Runda Arhiva educationala Marime 0.52 kb
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    FILE* in = fopen("aria.in", "r");
    FILE* out = fopen("aria.out", "w");

    int n;
    double ans = 0;
    fscanf(in, "%d", &n);
    
    double x1, y1, xp, yp, x, y;
    fscanf(in, "%lf%lf", &x1, &y1);
    xp = x1;
    yp = y1;

    for(int i = 1; i < n; i++) {
        fscanf(in, "%lf%lf", &x, &y);

        ans += (xp * y - x * yp) / 2;

        xp = x;
        yp = y;
    }

    ans += (x * y1 - x1 * y) / 2;

    fprintf(out, "%.5lf\n", ans);

    return 0;

}