记录编号 19113 评测结果 AAAAAAAAAAAAAAAA
题目名称 翻译玛雅著作 最终得分 100
用户昵称 GravatarDes. 是否通过 通过
代码语言 Pascal 运行时间 0.790 s
提交时间 2010-09-28 21:34:43 内存使用 0.11 MiB
显示代码纯文本
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.