为什么40分?????

P1914 小书童——凯撒密码

Maple_ @ 2017-08-14 09:47:11

var i,j,k,l,r,t,n,m,len:longint;
s1,s2,s3,ss,si,st,sr:string;
begin
  assign(input,'');
  assign(output,'');
  reset(input);
  rewrite(output);
  l:=0;
  readln(s1);
  len:=length(s1);
  if ord(s1[1])<91 then begin
                          s2:=chr(ord(s1[1])+32);
                          s3:=s1[1];
                          for i:=2 to len do
                          begin
                            s2:=s2+s1[i];
                            s3:=s3+chr(ord(s1[i])-32);
                          end;
                        end
  else begin
         s2:=chr(ord(s1[1])-32);
         s3:=chr(ord(s1[1])-32);
         for i:=2 to len do
         begin
           s2:=s2+s1[i];
           s3:=s3+chr(ord(s1[i])-32);
         end;
       end;
  writeln(s3);
  readln(si);
  for i:=1 to length(si) do
  begin
    ss:=si[i];
    if ss<>' ' then st:=st+ss
    else begin
           if (st=s1)or(st=s2)or(st=s3) then begin
                                               inc(t);
                                               if l=0 then l:=i-length(s1);
                                             end;
           {else if st=s2 then begin
                                inc(t);
                                if l=0 then l:=i-length(s2);
                              end;}
           //write(st,' ');
           st:='';
         end;
  end;
  if (st=s1)or(st=s2)or(st=s3) then begin
                                      inc(t);
                                      if l=0 then l:=i-length(s1);
                                    end;
  if t=0 then writeln(-1)
  else writeln(t,' ',l-1);
  close(input);
  close(output)
end.

by half_cooler @ 2017-09-25 17:16:05

怎么这方法那么复杂


|