比赛 20091110 评测结果 WWWWWEEEEAWWWEWWWWWW
题目名称 溶液混合 最终得分 5
用户昵称 chengyang 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-10 11:52:47
显示代码纯文本
program mix;
var
  aa,bb:array[0..51] of longint;
  cc:array[0..101] of longint;
  xx,b,d,low,high:real;
  i,j,n,v,a,c:longint;
begin
  assign(input,'mix.in');
  assign(output,'mix.out');
  reset(input);
  rewrite(output);
  readln(n);
  for i:=1 to n do read(aa[i]);
  for i:=1 to n do read(bb[i]);
  for i:=1 to n do cc[aa[i]]:=cc[aa[i]]+bb[i];
  read(v);
  for i:=0 to v-1 do begin
    a:=a+cc[i];
    b:=b+cc[i]*i/100;
  end;
  for i:=v+1 to 100 do begin
    c:=c+cc[i];
    d:=d+cc[i]*i/100;
  end;
  if (a=0) and (c=0) then  begin
    xx:=cc[v];
    write(xx:0:5);
    close(input);
    close(output);
    halt;
  end
  else
  low:=b/a;
  high:=d/c;
  if a<c then begin
    xx:=(100*b-v*a)/(v-100*high);
    write((xx+a+cc[v]):0:5);
  end
  else begin
    xx:=(100*d-v*c)/(v-100*low);
    write((xx+c+cc[v]):0:5);
  end;
  close(input);
  close(output);
end.