比赛 |
模拟测试2 |
评测结果 |
WWWWWWWWWWWWTTTT |
题目名称 |
翻译玛雅著作 |
最终得分 |
0 |
用户昵称 |
magic |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-10-12 21:47:48 |
显示代码纯文本
program gls;
var
cha:array[1..52]of char;
num:array[1..52]of longint;
str,ss,bas:string; {bas basic string,ss goal string}
a,b,n,max:longint;
f,g:text;
procedure putin;
var
i:longint;
begin
assign(f,'writing.in');
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;
end;
procedure main;
var j:longint;
st:string;
function work(c:string):boolean;
var
mm:array[1..52]of longint;
flag:boolean; p,l:longint;
begin p:=0;
for l:=1 to l do mm[l]:=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 inc(p);
if p=0 then work:=true;
end;
begin
for j:=1 to b-3 do begin
st:=copy(ss,j,a);
if work(st)=true then inc(max);
end;
end;
procedure putout;
var z:longint;
begin
assign(g,'writing.out');
rewrite(g);
{writeln(g,str);
for z:=1 to 52 do write(g,num[z]);}
writeln(g,max);
end;
begin
str:='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for n:=1 to 52 do cha[n]:=str[n];
putin;
main;
putout;
close(f); close(g);
end.