Pagini recente » Cod sursa (job #457491) | Cod sursa (job #2127418) | Cod sursa (job #3228988) | Cod sursa (job #2464491) | Cod sursa (job #2547649)
#include <stdio.h>
#include <stdlib.h>
long double abs1( long double a ) {
if ( a < 0 )
return -a;
return a;
}
int main() {
FILE *fin, *fout;
fin = fopen ( "aria.in", "r" );
fout = fopen ( "aria.out", "w" );
long double n, x1, y1, x2, y2, i;
long double ans;
fscanf ( fin, "%Lf%Lf%Lf", &n, &x1, &y1 );
ans = 0;
for ( i = 1; i <= n - 1; i++ ) {
fscanf ( fin, "%llf%llf", &x2, &y2 );
ans = ans + ( x2 - x1 ) * ( y1 + y2 ) / 2;
x1 = x2;
y1 = y2;
}
fprintf( fout, "%.5Lf", abs1(ans) );
return 0;
}