Cod sursa(job #1535558)
| Utilizator | Data | 24 noiembrie 2015 22:08:55 | |
|---|---|---|---|
| Problema | Aria | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
using namespace std;
long double A = 0,a,b,c,d;
int main(){
ifstream f("aria.in");
ofstream of("aria.out");
int N;
pair<long double, double> p;
f >> N>> p.first >> p.second;
c = p.first; d = p.second;
if (N > 1){
for (int i = 1; i < N; ++i){
f >> a >> b;
A += p.first*b - a*p.second;
p.first = a; p.second = b;
}
A += p.first*d - p.second*c;
of << A / 2;
}
else of << "0";
}