Cod sursa(job #1259670)
Utilizator | Data | 10 noiembrie 2014 12:53:40 | |
---|---|---|---|
Problema | Aria | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.57 kb |
#include<fstream>
#include<iomanip>
using namespace std;
ifstream fin( "aria.in" );
ofstream fout( "aria.out" );
const int nmax = 100001;
double x[ nmax ], y[ nmax ];
int main() {
int n;
double ans;
fin >> n;
for( int i = 0; i < n; ++ i ) {
fin >> x[ i ] >> y[ i ];
}
ans = 0;
x[ n ] = x[ 0 ];
y[ n ] = y[ 0 ];
for( int i = 0; i < n; ++ i ) {
ans += ( x[ i ] * y[ i + 1 ] - x[ i + 1 ] * y[ i ] );
}
fout << setprecision( 6 ) << fixed;
fout << 0.5 * ans << "\n";
fin.close();
fout.close();
return 0;
}