更新时间2018-04-16 10:46:53
pascal写的参考(pascal适合这种教育型的)
var
a:array[1..10] of integer;
s,m,n,i:integer;
begin
for i:=1 to 100 do
read(a[i]);
s:=1;
m:=1;
n:=1;
for i:=1 to 100 do
begin
if a[i]>=60 then
s:=s+1
else
if a[i]>=80 then
m:=m+1
else
begin
m:=m+1;
n:=n+1;
end;
end;
writeln('p=',n/(m+n+s));
writeln('q=',(m+n)/(m+n+s));
end.