Mai intai trebuie sa te autentifici.
Cod sursa(job #2304089)
| Utilizator | Data | 17 decembrie 2018 15:13:01 | |
|---|---|---|---|
| Problema | Aria | Scor | 50 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.79 kb |
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f ("aria.in");
ofstream g ("aria.out");
int const NM = 1e5;
pair <double , double> v [1 + NM];
int n;
double base = int(1e6);
double mod (double x){
return x > 0 ? x : -x;
}
double area (double x , double y , double x1 , double y1){
return (double)(mod ((double)(x * y1 - x1 * y)));
}
int main()
{
f >> n;
double s = 0 ;
for(int i = 1 ; i <= n ; ++ i)
f >> v [i] . first >> v [i] . second ;
for(int i = 1 ; i < n ; ++ i)
s += area (v [i] . first, v [i] . second , v [1 + i] . first , v [1 + i] . second);
s += area (v [n] . first , v [n] . second , v [1] . first , v [1] . second);
s = (double)(s / 2);
g << fixed << setprecision (5) << s << '\n';
return 0;
}
