Cod sursa(job #1504100)
| Utilizator | Data | 17 octombrie 2015 12:22:31 | |
|---|---|---|---|
| Problema | Aria | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <fstream>
#include <vector>
using namespace std;
ifstream is("aria.in");
ofstream os("aria.out");
struct Punct{
double x, y;
} in, a, b;
int n;
double s;
int Aria(Punct A, Punct B);
int main()
{
is >> n;
is >> a.x >> a.y;
in.x = a.x; in.y = a.y;
for ( int i = 2; i <= n; ++i )
{
is >> b.x >> b.y;
s += Aria(a, b);
a = b;
}
s += Aria(a, in);
os << s;
is.close();
os.close();
return 0;
}
int Aria(Punct A, Punct B)
{
return ( A.x * B.y - A.y * B.x ) / 2;
}
