Cod sursa(job #2306345)
| Utilizator | Data | 22 decembrie 2018 01:38:52 | |
|---|---|---|---|
| Problema | Aria | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <fstream>
#define x first
#define y second
#include <iomanip>
using namespace std;
ifstream fin("aria.in");
ofstream fout("aria.out");
int n,i;
long double ans;
pair<long double,long double> v[100010];
int main() {
fin>>n;
for (i=1;i<=n;i++)
fin>>v[i].x>>v[i].y;
v[n+1]=v[1];
for (i=1;i<=n;i++)
ans+=(v[i].x*v[i+1].y-v[i+1].x*v[i].y);
ans/=2;
if (ans==(long long)ans)
fout<<(long long)ans;
else
fout<<fixed<<setprecision(6)<<ans;
return 0;
}
