记录编号 7718 评测结果 AAAAAAAAAAAAAAAAAAAA
题目名称 沙漠赛道 最终得分 100
用户昵称 GravatarEnAsn 是否通过 通过
代码语言 Pascal 运行时间 0.872 s
提交时间 2008-11-11 14:27:48 内存使用 2.40 MiB
显示代码纯文本
program ex;
type
 sz=array[0..1]of real;
 zs=array[1..4]of real;
 sh=array[0..1]of longint;
 ss=array[1..100000]of real;
var
 a:sz;
 b:ss;
 f1,f2:text;
 dj,zr:ss;
 dv,zv,max:real;
 n,bi:longint;
 zsh,dsh,pin:real;
procedure init;
 var
  i,j,y,z,d,k:longint;
  c:sh;
  x:real;
 begin
  assign(f1,'mirage.in');
  assign(f2,'mirage.out');
  reset(f1);
  rewrite(f2);
  for i:=1 to 4 do
   read(f1,zr[i]);
  readln(f1);
  for i:=1 to 4 do
   read(f1,dj[i]);
  readln(f1);
  readln(f1,z,d);
  y:=z+d;
  zv:=z/y;
  dv:=d/y;
  readln(f1,n);
  fillchar(c,sizeof(c),0);
  for i:=1 to n do
   begin
     readln(f1,b[i],k);
     a[k]:=a[k]+b[i];
     max:=max+b[i];
     bi:=i;
    end;
 end;
procedure main;
 var
  zb,zf,db,df:real;
  i:longint;
 begin
  zb:=1;
  zf:=1;
  db:=1;
  df:=1;
  for i:=1 to 4 do
   zb:=zb*(1-zr[i]);
  zf:=zf-zb;
  for i:=1 to 4 do
   db:=db*(1-dj[i]);
  df:=df-db;
  pin:=df*zf;
  zsh:=zb*df+zb*db*zv;
  dsh:=db*zf+db*zb*dv;
  write(f2,zsh:0:2,' ');
  write(f2,dsh:0:2,' ');
  writeln(f2,pin:0:2);
 end;
procedure print;
 var
  i,j:longint;
  zrs,djs,pinj,t,e:real;
 begin
  t:=1;e:=0;
  zrs:=0;
  djs:=0;
  pinj:=0;
  for i:=1 to bi do
   begin
    t:=t*exp(ln(b[i])/n);
   end;
  zrs:=max-a[0]*2;
  djs:=max-a[1]*2;
  pinj:=max-t*n;
  e:=zrs*zsh+djs*dsh+pin*pinj;
  writeln(f2,e:0:2);
 end;
begin
 init;
 main;
 print;
 close(f2);
end.