记录编号 | 14590 | 评测结果 | WWWWWWWWWW | ||
---|---|---|---|---|---|
题目名称 | 溶液模拟器 | 最终得分 | 0 | ||
用户昵称 | 是否通过 | 未通过 | |||
代码语言 | Pascal | 运行时间 | 0.222 s | ||
提交时间 | 2009-11-02 16:29:37 | 内存使用 | 0.34 MiB | ||
Program simulator; Type abc=record m:int64; c:real; x:boolean; end; sc=array [0..10000] of abc; Var i,j:longint; n:longint; s:sc; p,pp,o,tm:int64; k:char; tc,m:real; Begin assign(input,'simulator.in'); assign(output,'simulator.out'); reset(input); rewrite(output); readln(s[0].m,s[0].c); readln(n); s[0].c:=s[0].c/100; s[0].x:=true; for i:=1 to n do begin read(k); if k='P' then begin read(k); readln(tm,tc); m:=s[i-1].m*s[i-1].c; m:=m+tm*(tc/100); s[i].m:=s[i-1].m+tm; s[i].c:=m/s[i].m; s[i].x:=true; end else begin p:=i; while (s[p].x=false)and(p>0) do p:=p-1; if p>0 then begin s[i].m:=s[p-1].m; s[i].c:=s[p-1].c; end else begin s[i].m:=s[0].m; s[i].c:=s[0].c; end; readln; end; writeln(s[i].m,' ',(s[i].c*100):0:5); end; close(input); close(output); End.