比赛 20091110 评测结果 WWWWWWWEWAWWWEAAWWWW
题目名称 溶液混合 最终得分 15
用户昵称 ReimBurSe. 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-10 11:20:16
显示代码纯文本
Program mix;

Type
sc=array [1..50] of longint;

Var
c,v:sc;
i,j,temp:longint;
n:longint;
z:longint;
pc,m,vv,p,temp1:real;

Begin
assign(input,'mix.in');
assign(output,'mix.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do read(c[i]);
readln;
for i:=1 to n do read(v[i]);
readln;
readln(z);
for i:=1 to (n-1) do begin
 for j:=(i+1) to n do begin
  if c[i]>c[j] then begin
   temp:=c[i];
   c[i]:=c[j];
   c[j]:=temp;
   temp:=v[i];
   v[i]:=v[j];
   v[j]:=temp;
  end;
 end;
end;
i:=1;
m:=0;
vv:=0;
while (pc*100<=z)and(i<=n) do begin
 m:=m+c[i]/100*v[i];
 vv:=vv+v[i];
 pc:=m/vv;
 i:=i+1;
end;
i:=i-1;
if pc*100>z then begin
 m:=m-c[i]/100*v[i];
 vv:=vv-v[i];
 pc:=m/vv;
 while pc*100<z do begin
  m:=m+c[i]/100;
  vv:=vv+1;
  pc:=m/vv;
 end;
 if pc*100>z then begin
  m:=m-c[i]/100;
  vv:=vv-1;
  pc:=m/vv;
  p:=0;
  while pc*100<z do begin
   m:=m+c[i]/100*p;
   vv:=vv+p;
   pc:=m/vv;
   p:=p+0.000001;
  end;
 end;
end;
writeln(vv:0:5);
close(input);
close(output);
End.