记录编号 7742 评测结果 AAAAAAAAAAAAAAAAAAAA
题目名称 沙漠赛道 最终得分 100
用户昵称 Gravatarcuixiaofei 是否通过 通过
代码语言 Pascal 运行时间 0.887 s
提交时间 2008-11-11 15:47:38 内存使用 1.64 MiB
显示代码纯文本
program mirage;
  type
    real                        =double;
  var
    chehuo                      :array[1..4,1..2] of real;
    fadongji                    :array[1..2] of real;
    af,bf,abf,bbf               :real;
    asheng,bsheng,ping          :real;
    az,bz                       :real;
    shuchu                      :real;
    n,gea,geb                   :longint;
    dui                         :array[0..100000,1..2] of real;
    f1,f2                       :text;
  procedure init;
    var
      i,k,ge                    :longint;
      shu                       :real;
  begin
    assign(f1,'mirage.in');
    reset(f1);
    assign(f2,'mirage.out');
    rewrite(f2);
    fillchar(dui,sizeof(dui),0);
    az:=0;
    bz:=0;
    gea:=0;
    geb:=0;
    for i:=1 to 4 do
      read(f1,chehuo[i,1]);
    for i:=1 to 4 do
      read(f1,chehuo[i,2]);
    readln(f1,fadongji[1],fadongji[2]);
    readln(f1,n);
    for i:=1 to n do
      begin
        readln(f1,shu,k);
        if k=0 then
          begin
            inc(gea);
            dui[gea,1]:=shu;
            az:=az+shu;
          end
        else
          begin
            inc(geb);
            dui[geb,2]:=shu;
            bz:=bz+shu;
          end;
      end;
  end;
  procedure main;
    var
      i                         :longint;
      pingchenga,pingchengb     :real;
      yinga,yingb               :real;
      ji                        :real;
  begin
    abf:=1;
    bbf:=1;
    for i:=1 to 4 do
      abf:=abf*(1-chehuo[i,1]);
    for i:=1 to 4 do
      bbf:=bbf*(1-chehuo[i,2]);
    af:=1-abf;
    bf:=1-bbf;
    pingchenga:=fadongji[1]/(fadongji[1]+fadongji[2]);
    pingchengb:=1-pingchenga;
    asheng:=abf*bf+abf*bbf*pingchenga;
    bsheng:=bbf*af+abf*bbf*pingchengb;
    ping:=af*bf;
//    ****************** gailv *******************
    yinga:=az+bz-az*2;
    yingb:=az+bz-bz*2;
    ji:=1;
    for i:=1 to gea do
      ji:=ji*exp((1/(gea+geb))*ln(dui[i,1]));
    for i:=1 to geb do
      ji:=ji*exp((1/(gea+geb))*ln(dui[i,2]));
//    ji:=exp((1/(gea+geb))*ln(ji));
    ji:=az+bz-ji*(gea+geb);
    shuchu:=yinga*asheng+yingb*bsheng+ji*ping;
  end;
  procedure print;
  begin
    writeln(f2,asheng:0:2,' ',bsheng:0:2,' ',ping:0:2);
    writeln(f2,shuchu:0:2);
    close(f1);
    close(f2);
  end;

  begin
    init;
    main;
    print;
  end.