比赛 模拟测试2 评测结果 AAAAAAAAAAAAAAAA
题目名称 翻译玛雅著作 最终得分 100
用户昵称 nick09 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-10-12 19:32:27
显示代码纯文本
program writing;
type
  arr=array['A'..'z']of longint;

var l1,l2:longint;
    a,b:arr;
    f:text;
    n:array[1..3000000]of char;
    ans:longint;
function check:boolean;
var i:char;
begin
check:=false;
for i:='A'to 'Z' do
 if a[i]<>b[i] then exit;

for i:='a'to 'z' do
 if a[i]<>b[i] then exit;
check:=true;
end;

procedure init;
var  i,j:longint;
     c:char;
begin
assign(f,'writing.in');reset(f);
readln(f,l1,l2);
for i:=1 to l1 do
 begin read(f,c);inc(a[c]);end;
readln(f);
for i:=1 to l1 do
  begin read(f,c);inc(b[c]);n[i]:=c;end;
if check then ans:=1 else ans:=0;

for i:=l1+1 to l2 do
  begin
  read(f,c);n[i]:=c;inc(b[c]);
  dec(b[n[i-l1]]);
  if check then ans:=ans+1;
  end;
close(f);
assign(f,'writing.out');rewrite(f);
writeln(f,ans);close(f);
end;

Begin

init;

end.