Pagini recente » Borderou de evaluare (job #1628857) | Borderou de evaluare (job #1083536) | Borderou de evaluare (job #1082237) | Cod sursa (job #3363249) | Cod sursa (job #3363255)
#include <bits/stdc++.h>
using namespace std;
const int MAX = 10000;
int dp[MAX + 1];
int readInt(FILE *fin) {
int x, semn;
char ch;
ch = fgetc(fin);
while (isspace(ch)) {
ch = fgetc(fin);
}
semn = 1;
if (ch == '-') {
semn = -1;
ch = fgetc(fin);
}
x = 0;
while (isdigit(ch)) {
x = x * 10 + ch - '0';
ch = fgetc(fin);
}
return x * semn;
}
int minim(int a, int b) {
return a < b ? a : b;
}
int main()
{
FILE *fin, *fout;
int n, i, px, py, ulx, uly, x, y;
long long a;
double a2;
fin = fopen("aria.in", "r");
fscanf(fin, "%d%d%d", &n, &px, &py);
a = 0;
ulx = px;
uly = py;
for (i = 1; i < n; i++) {
x = readInt(fin);
y = readInt(fin);
a += (long long)ulx * y - (long long)uly * x;
ulx = x;
uly = y;
}
fclose(fin);
if (n > 1) {
a += (long long)ulx * py - (long long)uly * px;
}
a2 = a / (double)2;
fout = fopen("aria.out", "w");
fprintf(fout, "%.5lf\n", a2);
fclose(fout);
return 0;
}