Cod sursa(job #1974080)
Utilizator | Data | 26 aprilie 2017 19:15:13 | |
---|---|---|---|
Problema | Aria | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int main()
{
long double a = 0;
double x1, x2, x3, y1, y2, y3;
int N;
fin>>N;
fin>>x1>>y1>>x2>>y2;
for(int i = 3; i <= N; i++)
{
fin>>x3>>y3;
a += x1 * y2 + x2 * y3 + y1 * x3 - x3 * y2 - x1 * y3 - x2 * y1;
x2 = x3, y2 = y3;
}
fout<<a * 0.5;
return 0;
}