Cod sursa(job #1436253)
| Utilizator | Data | 15 mai 2015 16:43:09 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
int modul( float s)
{
return(max(s,-s));
}
int main()
{
float x,y,xf = 0,yf = 0,n,i,xi,yi;
float s = 0;
f >> n ;
f >> xi >> yi;
xf = xi;
yf = yi;
for( i = 2; i <= n; i++)
{
f >> x >> y;
s += x*yf - xf*yf;
xf = x;
yf = y;
}
s = (s + xi*y - x*yf) ;
g << std::setprecision(5) << modul(s);
return 0;
}
