Cod sursa(job #1375460)
Utilizator | Andrei Zaicescu andreizaicescu | Data | 5 martie 2015 13:18:58 |
---|---|---|---|
Problema | Aria | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream f("aria.in");
ofstream g("aria.out");
// (baza mare +baza mica)*inaltimea pe 2
double s=0;
double n,x1,y1,x2,y2,x3,y3,i;
f>>n;
f>>x1;
f>>y1;
x2=x1;
y2=y1;
for(i=2;i<=n;i++)
{
f>>x3;
f>>y3;
s+=((y3+y2)*(x3-x2)/2);
x2=x3;
y2=y3;
// g<<s<<" ";
}
s+=((x1-x2)*(y2+y1)/2);
g<<s*(-1);
f.close();
g.close();
return 0;
}