Pascal!码风不太好,请见谅,谢谢!!!
查看原帖
Pascal!码风不太好,请见谅,谢谢!!!
209402
永hhyhhyhhy乐楼主2020/7/4 20:58
var
  s,s1:string;
  n,m,k,i,j,x:longint;
begin
  readln(n,m,k);
  readln(s);
  i:=1;
  while i<=length(s) do
   begin
    if s[i]<>'-' then s1:=s1+s[i]
     else if ord(s[i+1])-ord(s[i-1])=1 then begin s1:=s1+s[i+1];inc(i);end
      else if (ord(s[i-1])>ord(s[i+1]))or(ord(s[i-1])=ord(s[i+1])) then s1:=s1+s[i] else if (i=1)or(i=length(s)) then s1:=s1+s[i] else if s[i+1]='-' then begin s1:=s1+s[i]+s[i+1];inc(i);end else if (s[i-1] in ['0'..'9'])and(s[i+1] in ['a'..'z'])or(s[i+1]
in ['0'..'9'])and(s[i-1]
 in ['a'..'z']) then s1:=s1+s[i] else begin if n=1 then begin if k=1 then
        begin
          for j:=ord(s[i-1])+1 to ord(s[i+1])-1 do
           for x:=1 to m do s1:=s1+chr(j);
            end
           else if k=2 then
            for j:=ord(s[i+1])-1 downto ord(s[i-1])+1 do
             for x:=1 to m do s1:=s1+chr(j);
          end
        else if n=2 then if s[i-1] in ['a'..'z'] then begin if k=1 then
        begin
          for j:=ord(s[i-1])+1 to ord(s[i+1])-1 do
           for x:=1 to m do s1:=s1+chr(j-32);
            end
           else if k=2 then
            for j:=ord(s[i+1])-1 downto ord(s[i-1])+1 do
             for x:=1 to m do s1:=s1+chr(j-32);
          end
       else if n=3 then for j:=1 to m do s1:=s1+'*';
     end;
    inc(i);
   end;
  writeln(s1);
end.

2020/7/4 20:58
加载中...