比赛 NOIP2008集训模拟2 评测结果 AAAAAAAAAAAAAAAAAAAA
题目名称 沙漠赛道 最终得分 100
用户昵称 zhai 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-11 10:51:21
显示代码纯文本
program mirage;
  const
    max=100000;
  type
    sz=array[1..4]of real;
  var
    n,a,b:longint;
    sa,sb,sc:real;
    f1,f2:text;
    ans:real;
    s1,s2:sz;
    procedure ini;
      var
        i:integer;
      begin
        assign(f1,'mirage.in');reset(f1);
        assign(f2,'mirage.out');rewrite(f2);
        fillchar(s1,sizeof(s1),0);
        fillchar(s2,sizeof(s2),0);
        for i:=1 to 4 do read(f1,s1[i]);
        for i:=1 to 4 do read(f1,s2[i]);
        readln(f1,a,b);
        readln(f1,n);
        ans:=0;
      end;
    procedure suan1;
      var
        i,j:integer;
        x,y:real;
        h,g:real;
      begin
        for i:=1 to 4 do begin
          s1[i]:=1-s1[i];
          s2[i]:=1-s2[i];
        end;
        x:=1;y:=1;
        for i:=1 to 4 do begin
          x:=x*s1[i];
          y:=y*s2[i];
        end;
        h:=a/(a+b);
        g:=b/(a+b);
        sa:=x*(1-y+y*h);
        sb:=y*(1-x+x*g);
        sc:=1-sa-sb;
      end;
    procedure main;
      var
        i,j:longint;
        x,y,a1:real;
        a3:real;
        a2:integer;
      begin
        x:=0;y:=0;
        a3:=1;
        for i:=1 to n do begin
          read(f1,a1);
          readln(f1,a2);
          a3:=a3*exp(ln(a1)/n);
          if a2=0 then x:=x+a1
          else y:=y+a1;
        end;
        close(f1);
        ans:=(y-x)*sa;
        ans:=ans+(x-y)*sb;
        ans:=ans+(x+y-a3*n)*sc;
      end;
  begin
    ini;
    suan1;
    main;
    writeln(f2,sa:0:2,' ',sb:0:2,' ',sc:0:2);
    writeln(f2,ans:0:2);
    close(f2);
  end.