题目: |
Program ex303; Const
NN=7; Type
Arr1=array[0..30] of char;由OIFans.cn收集
var
s:arr1;
k,p:integer;
Function fun(s:arr1; a:char;n:integer):integer;
var
j:integer;
begin
j:=n;
while (a<s[j])and(j>0) do dec(j);
fun:=j;
end;
begin
for k:=1 to NN do
s[k]:=chr(ord('A')+2*k+1);
k:=fun(s,'M',NN);
writeln(k);
end. 输出:5
|