Cod sursa(job #1383994)
| Utilizator | Data | 10 martie 2015 19:54:49 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.65 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;
}
