比赛 20100927 评测结果 AAAAAAAAAAAATTTT
题目名称 翻译玛雅著作 最终得分 75
用户昵称 Des. 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-09-27 19:47:30
显示代码纯文本
program writing;
var s,p:ansistring;
    t,k,m,n,i,j:longint;
    c:char;
    b,q:array['A'..'z']of integer;
    {a:array[1..1000000]of ansistring;}
    bo,po:boolean;
begin
assign(input,'writing.in');
reset(input);
assign(output,'writing.out');
rewrite(output);
readln(n,m);
for t:=1 to n do
  begin
    read(c);
    inc(b[c]);
  end;
readln;
readln(s);
for t:=1 to m-n+1 do
  begin
    q:=b;
    bo:=true;
    p:=copy(s,t,n);
    for k:=1 to n do
      dec(q[p[k]]);
    for c:='A' to 'z' do
      if q[c]>0 then
        begin
          bo:=false;
          break;
        end;
    if bo then inc(j);
      {begin
        for k:=1 to j do
          if p=a[k] then
            break;
        if(j=0)or(p<>a[k]) then
          begin
            inc(j);
            a[j]:=p;
          end;
      end;}
  end;
writeln(j);
close(output);
end.