Cod sursa(job #1338036)
| Utilizator | Data | 9 februarie 2015 19:05:04 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
ifstream in("aria.in");
ofstream out("aria.out");
long double aria=0, x1, y1, xi, yi, xi2, yi2;
long n;
in>>n;
in>>xi>>yi;
x1=xi; y1=yi;
for(long i=2; i<=n; ++i)
{
in>>xi2>>yi2;
aria+=xi*yi2-xi2*yi;
xi=xi2;
yi=yi2;
}
xi2=x1;
yi2=y1;
aria+=xi*yi2-xi2*yi;
aria/=2;
out<<fixed<<setprecision(5)<<aria<<'\n';
in.close(); out.close();
return 0;
}
