记录编号 19684 评测结果 AAAAAAAAAAAATTTE
题目名称 翻译玛雅著作 最终得分 75
用户昵称 Gravatarmagic 是否通过 未通过
代码语言 Pascal 运行时间 9.270 s
提交时间 2010-10-14 22:07:21 内存使用 0.11 MiB
显示代码纯文本
program gls;

var
 cha:array[1..52]of char;
 num:array[1..52]of longint;
 str,ss,bas:ansistring; {bas basic string,ss goal string}
 a,b,n,max:longint;
 f,g:text;

  procedure putin;
  var
  i:longint;
  begin
  assign(f,'writing.in');assign(g,'writing.out');  rewrite(g);
  reset(f);

  readln(f,a,b);
  readln(f,bas);
  readln(f,ss);

  for i:=1 to a do begin if (bas[i]>='a')and(bas[i]<='z') then inc(num[ord(bas[i])-96]);
                         if (bas[i]>='A')and(bas[i]<='Z') then inc(num[ord(bas[i])-38]);
                                                                             end;

   close(f);
  end;

 procedure main;
 var j:longint;
     st:string;flag:boolean;

    procedure work(c:string);
    var
    mm:array[1..52]of longint;
       p,l:longint;
    begin p:=0;
    fillchar(mm,sizeof(mm),0);


       flag:=false;
     for l:=1 to a do begin if (c[l]>='a')and(c[l]<='z') then inc(mm[ord(c[l])-96]);
                            if (c[l]>='A')and(c[l]<='Z') then inc(mm[ord(c[l])-38]);
                      end;
    { for l:=1 to 52 do write(g,mm[l]); writeln(g); }
     for l:=1 to 52 do if num[l]<>mm[l] then exit;
  { writeln(g,p);}     flag:=true;
    end;

 begin
   for j:=1 to b-a+1 do  begin
     st:=copy(ss,j,a);
       { writeln(g,st);}
       work(st);
       if flag=true then inc(max);
     end;
 end;
   procedure putout;
   var z:longint;
   begin



    {writeln(g,str);}
    {for z:=1 to 52 do write(g,num[z]); }
    writeln(g,max);
    close(g);
   end;

begin

 str:='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
 for n:=1 to 52 do cha[n]:=str[n];
 putin;
 main;
 putout;

end.