Mai intai trebuie sa te autentifici.
Cod sursa(job #1539999)
| Utilizator | Data | 1 decembrie 2015 21:36:42 | |
|---|---|---|---|
| Problema | Aria | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include <fstream>
#include <iomanip>
using namespace std;
ifstream f("aria.in");
ofstream g("aria.out");
const int NMax = 100005;
int n;
float arie;
pair <float , float> a[NMax];
void Solve()
{
for(int i = 1; i <= n; i++)
{
arie += a[i].first*a[i+1].second - a[i+1].first*a[i].second;
}
arie = arie/2;
}
void Print()
{
g<<fixed<<setprecision(6)<<arie;
}
void Read()
{
f>>n;
for(int i = 1; i <= n; i++)
{
f>>a[i].first>>a[i].second;
}
a[n+1] = a[1];
}
int main()
{
Read();
Solve();
Print();
return 0;
}
