比赛 NOIP2008集训模拟2 评测结果 AAAAAAAAAAAAAAAWWWWW
题目名称 沙漠赛道 最终得分 75
用户昵称 bing 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-11 11:27:12
显示代码纯文本
program mirage;
var
  fin,fout:text;
  zrgz,djgz:array[1..4] of real;
  zrq,djq:array[1..100000] of real;
  zrdl,djdl,s,ss,ss1,ss2,ss3,zr1,dj1:real;
  i,j,n,k1,k2:integer;

procedure init;
begin
  for i:=1 to 4 do read(fin,zrgz[i]);
  for i:=1 to 4 do read(fin,djgz[i]);
  read(fin,zr1,dj1);
  read(fin,n);
  ss:=0;
  k2:=0;
  k1:=0;
  for i:=1 to n do
  begin
    readln(fin,s,j);
    ss1:=ss1+s;
    if j=0 then
    begin
      inc(k1);
      zrq[k1]:=s;
      ss2:=ss2+s*2;
    end
    else
    begin
      inc(k2);
      djq[k2]:=s;
      ss3:=ss3+s*2;
    end;
  end;
end;

procedure jisuan;
var
  a1,a2,a3,a4,a5,a6,a7,a10:real;
  asw1,asw2,asw3,asw4:real;
begin
  a4:=zr1/(zr1+dj1);
  a5:=dj1/(zr1+dj1);
  a1:=1;
  a2:=1;
  for i:=1 to 4 do
  begin
    a1:=(1-zrgz[i])*a1;
    a2:=(1-djgz[i])*a2;
  end;
  asw3:=(1-a1)*(1-a2);
  asw1:=a1*(1-a2)+a1*a2*a4;
  asw2:=a2*(1-a1)+a1*a2*a5;
  writeln(fout,asw1:0:2,' ',asw2:0:2,' ',asw3:0:2);
  a6:=1;
  for i:=1 to k2 do
  begin
    a10:=exp(ln(djq[i])/n);
    a6:=a6*a10;
  end;
  for i:=1 to k1 do
  begin
    a10:=exp(ln(zrq[i])/n);
    a6:=a6*a10;
  end;
  a7:=ss1-a6*n;
  asw4:=asw1*(ss1-ss2)+asw2*(ss1-ss3)+asw3*a7;
  writeln(fout,asw4:0:2);
end;

begin
  assign(fin,'mirage.in');
  assign(fout,'mirage.out');
  reset(fin);
  rewrite(fout);

  init;
  jisuan;

  close(fin);
  close(fout);
end.