Cod sursa(job #1744921)

Utilizator mihaitamoglanmihai moglan mihaitamoglan Data 20 august 2016 18:49:05
Problema Aria Scor 0
Compilator fpc Status done
Runda Arhiva educationala Marime 1.15 kb
type punct=record
            x,y:longint;
            end;
     tablou=array [1..100005]of punct;
var t:tablou;
    x0,y0,y,i,j,k,m,n:longint;
    aria:double;
    f,g:text;
    b:boolean;
    s,cuv:string;

begin
assign(f,'aria.in');
assign(g,'aria.out');
reset(f);
rewrite(g);
read(f,n);
for i:=1 to n do
 read(f,t[i].x,t[i].y);
x0:=0;
y0:=0;
b:=true;
while b do
 begin
  b:=false;
  i:=1;
  while (t[i].x<>x0)and(t[i].y<>y0)and (i<=n) do
   i:=i+1;
  if i<=n then begin
               b:=true;
               y0:=y0+1;
               end;
 end;
i:=1;
while i<=n-1 do
 begin
   aria:=aria+0.5*(x0*t[i].y+t[i].x*t[i+1].y+t[i+1].x*y0-t[i+1].x*t[i].y-x0*t[i+1].y-t[i].x*y0);
   i:=i+1;
 end;
aria:=aria+0.5*(x0*t[n].y+t[n].x*t[ 1 ].y+t[  1].x*y0-t[ 1 ].x*t[n].y-x0*t[  1].y-t[n].x*y0);
str(aria,s);
i:=1;
while s[i]<>'.' do
 i:=i+1;
n:=i;
cuv:=s[length(s)-2]+s[length(s)-1]+s[length(s)];
val(cuv,m,k);
cuv:='';
for i:=1 to n-1 do
 cuv:=cuv+s[i];
for i:=n+1 to n+m do
 cuv:=cuv+s[i];
 cuv:=cuv+'.';
for i:=n+m+1 to n+m+5 do
 cuv:=cuv+s[i];
while cuv[1]=' ' do
  delete(cuv,1,1);
write(g,cuv);
close(f);
close(g);
end.