2006年全国信息学奥赛复赛普及组(pascal)试题

来源:百度知道 编辑:UC知道 时间:2024/05/21 09:11:01
要答案

program count;
var s,t,w,s1,i,j:integer;
str1:string;
a:array[1..25]of byte;

procedure print;
var i:integer;
begin
for i:=1 to w do
write(chr(a[i]+ord('a')-1));
writeln;
end;

begin
assign(input,'count.in');
reset(input);
assign(output,'count.out');
rewrite(output);
readln(s,t,w);
readln(str1);
for i:=1 to w do
a[i]:=ord(str1[i])-ord('a')+1;
s1:=0;j:=w;
while(a[1]<=t-w+1)and(s1<5)do
begin
inc(a[j]);
while a[j]<=t do
begin
if j=w then begin
s1:=s1+1;
print;
inc(j);
break;
end
else begin
inc(j);
a[j]:=a[j-1]+1;