Pagini recente » Cod sursa (job #2382813) | Cod sursa (job #646220) | Cod sursa (job #2317192) | Cod sursa (job #2332990) | Cod sursa (job #2921946)
#include <fstream>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iomanip>
#define epsilon 1e-12
using namespace std;
typedef pair<double,double> Point;
Point points[150000];
Point operator-(Point a, Point b){
return Point(a.first - b.first, a.second - b.second);
}
double angle(Point a){
return atan2(a.first, a.second);
}
double det(Point a, Point b){
return (a.first * b.second - a.second * b.first)/2;
}
int main(){
ifstream fin("aria.in");
ofstream fout("aria.out");
int n;
fin >> n;
for(int i = 0; i < n; ++i){
fin >> points[i].first >> points[i].second;
}
double area = 0;
for(int i=1; i <= n - 2; ++i){
area += det(points[i] - points[0], points[i + 1] - points[0]);
}
fout << abs(area);
}