状态题目:化学课配置溶液
题目编号:495-化学课配置溶液 查看该题
状态: Unaccepted
测评机: Xeost[5]
得分: 90分
提交日期: 2009-7-9 15:43:00
有效耗时: 1030毫秒
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时62ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时47ms
测试结果5: 通过本测试点|有效耗时47ms
测试结果6: 通过本测试点|有效耗时46ms
测试结果7: 通过本测试点|有效耗时62ms
测试结果8: 通过本测试点|有效耗时47ms
测试结果9: 通过本测试点|有效耗时47ms
测试结果10: 通过本测试点|有效耗时62ms
测试结果11:
测试结果12:
测试结果13:
测试结果14:
测试结果15:
测试结果16:
测试结果17:
测试结果18:
测试结果19:
测试结果20:
http://www.rqnoj.cn/Status_Show.asp?SID=197279
http://www.rqnoj.cn/Status_Show.asp?SID=196999
程序如下:请帮忙在测试,谢谢jollwish!
var n,i,j:longint;
t,dg,x,y,x2,y2,t2:real;
a,b:array[1..50] of real;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
read(b[i]);
readln(dg);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
t:=a[i];a[i]:=a[j];a[j]:=t;
t:=b[i];b[i]:=b[j];b[j]:=t;
end;
x:=0;y:=0;
for i:=1 to n do
begin
x2:=x+b[i];
y2:=(x*y+a[i]*b[i])/x2;
x:=x2;
y:=y2;
end;
if y>dg then
begin
for i:=n downto 1 do
begin
if abs(y2-dg)<1e-9 then break;
x2:=x-b[i];
if abs(x2)>1e-9 then y2:=(x*y-a[i]*b[i])/x2;
if y2-dg<1e-9 then break;
y:=y2;
x:=x2;
end;
if (abs(x)>1e-9) and (abs(y-dg)>1e-9) then
begin
t:=(dg*x-x*y)/(dg-a[i]);
x:=x-t;
end;
end
else
begin
for i:=1 to n do
begin
if abs(y2-dg)<1e-9 then break;
x2:=x-b[i];
if abs(x2)>1e-9 then y2:=(x*y-a[i]*b[i])/x2;
if y2-dg>1e-9 then break;
y:=y2;
x:=x2;
end;
if (abs(x)>1e-9) and (abs(y-dg)>1e-9) then
begin
t:=(dg*x-x*y)/(dg-a[i]);
x:=x-t;
end;
end;
writeln(x:0:5);
end.