Mai intai trebuie sa te autentifici.
Cod sursa(job #2181998)
| Utilizator | Data | 21 martie 2018 23:38:03 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.63 kb |
#include<fstream>
#include<iomanip>
#define DMAX 100005
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct pct{
long double x, y;
};
pct v[DMAX];
long double abs(long double x){
if(x >= 0)
return x;
else return -x;
}
int main(){
int n;
fin>>n;
for(int i=0; i<n; i++){
fin>>v[i].x>>v[i].y;
}
v[n].x = v[0].x;
v[n].y = v[0].y;
long double S = 0;
for(int i=0; i<n; i++){
S += v[i].x * v[i+1].y - v[i+1].x * v[i].y;
}
if(S < 0) S*= -1;
S /= 2;
fout<<fixed<<setprecision(5)<<S;
return 0;
}
