比赛 模拟测试2 评测结果 AAAAAAAAAAAAAAAA
题目名称 翻译玛雅著作 最终得分 100
用户昵称 Des. 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-10-12 19:09:34
显示代码纯文本
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);   
q:=b;   
p:=copy(s,1,n);   
for k:=1 to n do  
  dec(q[p[k]]);   
bo:=true;   
for c:='A' to 'Z' do  
      if q[c]>0 then  
        begin  
          bo:=false;   
          break;   
        end;   
    if bo then  
      for c:='a' to 'z' do  
        if q[c]>0 then  
          begin  
            bo:=false;   
            break;   
          end;   
    if bo then inc(j);   
for t:=2 to m-n+1 do  
  begin  
    bo:=true;   
    dec(q[s[t+n-1]]);   
    inc(q[s[t-1]]);   
    for c:='A' to 'Z' do  
      if q[c]>0 then  
        begin  
          bo:=false;   
          break;   
        end;   
    if bo then  
      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.