不是VIP会员,不能显示答案

题目解答

题目:
Program cz2010_3;
var fu,a,num,b,tot,k,n:longint;
shu:boolean;c:char;
begin
num:=0;a:=0;fu:=1;shu:=false;b:=0;
while not(eoln) do begin //当一行输入未结束时
read(c);
if c='-' then fu:=-1
else if (c<='9') and (c>='0') then begin
val(c,k); num:=10*num+k; shu:=true; end;
else if shu then begin
shu:=false;
if (fu=1) and (num>0) then inc(a);
if fu=-1 then inc(b);
inc(tot,num*fu);
inc(n);num:=0;fu:=1;
end;
end;
if shu then begin
shu:=false;
if (fu=1) and (num>0) then inc(a);
if fu=-1 then inc(b);
inc(n); inc(tot,num*fu);
num:=0;fu:=1;
end;
writeln(tot/n:0:3,' ',a,' ',b);
close(input);close(output);
end.
【输入】
54hiy-24 51
输出:27.000 2 1
考点:
分析:
解答:
评论:
老师: