Mai intai trebuie sa te autentifici.
Cod sursa(job #2070156)
Utilizator | Data | 19 noiembrie 2017 11:59:24 | |
---|---|---|---|
Problema | Aria | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.6 kb |
#include <fstream>
#include <iomanip>
using namespace std;
ifstream in("aria.in");
ofstream out("aria.out");
double modul(double val){
if(val < 0)
return -val;
return val;
}
int main()
{
int n;
double sol = 0, xi, yi, xant, yant, x, y;
in>>n>>x>>y;
xi = xant = x;
yi = yant = y;
for(int i=2;i<=n;i++){
in>>x>>y;
sol += (xant * y - yant * x);
xant = x;
yant = y;
}
in.close();
sol += (x * yi - y * xi);
sol = modul(sol)/2;
out<<fixed<<setprecision(5)<<sol<<"\n";
out.close();
return 0;
}