比赛 NOIP2008集训模拟2 评测结果 AAAAAAAAAAEEEEEEEEEE
题目名称 沙漠赛道 最终得分 50
用户昵称 NOIer 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-11 11:14:23
显示代码纯文本
Program mirage;
  Const
   MaxN  =  100000;
   Inf   =  'mirage.in';
   Ouf   =  'mirage.out';
  Var
    Value         :array[1..4,1..2] of real;
    Data          :array[1..2] of real;
    x1,x2,x3,x4   :real;
    t1,t2,Pj      :real;
    z1,z2         :real;
    sc            :real;
    n,g1,g2       :Longint;
    XTR           :array[0..MaxN,1..2] of real;

  Procedure Init;
   Var
      i,k:Longint;
      shimano:Real;
   Begin
    assign(input,Inf); reset(input);
    assign(output,Ouf); rewrite(output);
    fillchar(Xtr,sizeof(Xtr),0);
    z1:=0; z2:=0; g1:=0; g2:=0;
    For i:=1 to 4 do read(Value[i,1]);
    For i:=1 to 4 do read(Value[i,2]);
    Readln(Data[1],Data[2]);
    Readln(n);
    For i:=1 to n do
      Begin
        readln(shimano,k);
        if k=0 then
          Begin
            inc(g1);
            Xtr[g1,1]:=shimano;
            z1:=z1+shimano;
          End
        Else
          Begin
            inc(g2);
            Xtr[g2,2]:=shimano;
            z2:=z2+shimano;
          End;
      End;
  End;

  Procedure Main;
   Var
    i:longint;
    Temp1,Temp2:real;
    zx1,zx2:real;
    Magotan:real;
   Begin
    x3:=1; x4:=1;
    For i:=1 to 4 do x3:=x3*(1-Value[i,1]);
    For i:=1 to 4 do x4:=x4*(1-Value[i,2]);
    x1:=1-x3; x2:=1-x4;
    Temp1:=Data[1]/(Data[1]+Data[2]); Temp2:=1-Temp1;
    t1:=x3*x2+x3*x4*Temp1; t2:=x4*x1+x3*x4*Temp2;
    Pj:=x1*x2;
    zx1:=z1+z2-z1*2;
    zx2:=z1+z2-z2*2;
    Magotan:=1;
    For i:=1 to g1 do Magotan:=Magotan*Xtr[i,1];
    For i:=1 to g2 do Magotan:=Magotan*Xtr[i,2];
    Magotan:=exp((1/(g1+g2))*ln(Magotan)); Magotan:=z1+z2-Magotan*(g1+g2);
    sc:=zx1*t1+zx2*t2+Magotan*Pj;
  End;

  Procedure Print;
  Begin
    writeln(t1:0:2,' ',t2:0:2,' ',Pj:0:2);
    writeln(sc:0:2);
    close(input);
    close(output);
  End;

  Begin
    Init;
    Main;
    Print;
  End.