Pagini recente » Cod sursa (job #2908286) | Cod sursa (job #1667213) | Cod sursa (job #775523) | Cod sursa (job #2307023) | Cod sursa (job #223255)
Cod sursa(job #223255)
program diviz;
const ct=30103;
var n,x,k:string[200];
ok,ok2:boolean;
t,ca,l1,l2,i,j,lung,rasp,a,b,stg:integer;
f:text;
begin
assign(f,'diviz.in'); reset(f);
readln(f,ca,a,b);
readln(f,n);
close(f);
str(ca,k);
rasp:=0;
x:=k;
lung:=length(n);
l2:=length(k);
while length(x)<=b do
begin
l1:=length(x);
if a<=length(x) then
begin
i:=0;
ok:=true;
stg:=0;
repeat
i:=i+1;
j:=stg;
ok2:=false;
if stg<lung then
repeat
j:=j+1;
if x[i]=n[j] then
begin
stg:=j;
ok2:=true
end;
until ok2 or (j=lung);
if not ok2 then
ok:=false;
until (not ok) or (i=l1);
if ok then
rasp:=(rasp+1) mod ct;
end;
i:=1; j:=1;
l1:=length(x);
t:=0;
while j<=l2 do
begin
ca:=ord(x[l1-i+1])+ord(k[l2-j+1])-96+t;
x[l1-i+1]:=chr(48+(ca mod 10));
t:=ca div 10;
i:=i+1; j:=j+1;
end;
while i<=l1 do
begin
ca:=ord(x[l1-i+1])+t-48;
x[l1-i+1]:=chr(48+(ca mod 10));
t:=ca div 10;
i:=i+1;
end;
if t>0 then
x:=chr(48+t)+x;
end;
assign(f,'diviz.out'); rewrite(f);
writeln(f,rasp);
close(f);
end.