分析
超级暴力,在尾部+1,再判断。
AC代码
type arr=array[0..27]of longint;var st:string; a:array[0..27]of longint; s,t,w,i:longint; procedure print(a:arr);var i:longint;begin for i:=w downto 1 do write(chr(a[i]+96)); writeln;end;function check(a:arr):boolean;var i:longint;begin for i:=w-1 downto 1 do if (a[i+1]<=a[i])and(not((a[i]>=s)and(a[i]<=t)and(a[i+1]>=s)and(a[i+1]<=t))) then exit(false); exit(true);end;procedure solve(a:arr);var i,cnt,kkk:longint;begin cnt:=0; while cnt<5 do begin inc(a[1]); kkk:=1; for i:=1 to w do if a[i]>t then begin a[i]:=s; inc(a[i+1]); end; for i:=w-1 downto 1 do if a[i]