Cod sursa(job #1483084)
| Utilizator | Data | 8 septembrie 2015 17:51:48 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <fstream>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
struct Point
{
double x,y;
};
const int NMax = 100005;
int N;
Point P[NMax];
int main()
{
double S = 0;
fin>>N;
for(int i = 1; i <= N; ++i)
{
fin>>P[i].x>>P[i].y;
}
P[N+1] = P[1];
for(int i = 1; i <= N; ++i)
{
S += P[i].x*P[i+1].y - P[i+1].x*P[i].y;
}
fout << S / 2 <<"\n";
return 0;
}
