Pagini recente » Cod sursa (job #1351887) | Cod sursa (job #2115556) | Cod sursa (job #890670) | Cod sursa (job #1516851) | Cod sursa (job #1383994)
#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;
}