记录编号 |
14599 |
评测结果 |
AAAAAAAAAA |
题目名称 |
溶液模拟器 |
最终得分 |
100 |
用户昵称 |
rottenwood |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.180 s |
提交时间 |
2009-11-02 16:44:01 |
内存使用 |
0.23 MiB |
显示代码纯文本
program simulator;
var
i,j,k,m,n,f,code,v0,v:longint;
flag:boolean;
s1,s2:string;
s:array[1..10001] of real;
ss:array[1..10001] of longint;
rz,nrz,c0,c,ans:real;
begin
assign(input,'simulator.in');reset(input);
assign(output,'simulator.out');rewrite(output);
readln(v0,c0);
readln(n);
f:=1;
ss[f]:=v0;s[f]:=c0;
for i:=1 to n do
BEGIN
flag:=false;
readln(s1);
s2:=copy(s1,1,1);
if s2='P' then
begin
flag:=true;
delete(s1,1,2);
s2:=copy(s1,1,pos(' ',s1)-1);
val(s2,v,code);
delete(s1,1,pos(' ',s1));
s2:=s1;
val(s2,c,code);
end
else flag:=false;
if flag then
begin
inc(f);
rz:=v0*c0*0.01;
nrz:=v*c*0.01;
rz:=rz+nrz;
v0:=v0+v;
ans:=rz/v0*100;
c0:=ans;
ss[f]:=v0;s[f]:=ans;
writeln(ss[f],' ',s[f]:0:5);
end
else
if f>1 then
begin
dec(f);
if f<1 then f:=1;
v0:=ss[f];c0:=s[f];
writeln(v0,' ',c0:0:5);
end
else writeln(v0,' ',c0:0:5);
END;
close(output);
end.