|
|
вернуться в форумWhy Compilation Error??? type vector=array[0..750000] of longint; long_string=array[1..500000] of char; var n:longint; s,t:long_string; i:longint; function qqq(s,t:long_string; n:longint):longint; var f:vector; k,i:longint; result:longint; begin result:=-1; f[1]:=0; k:=0; for i:=2 to n do begin while (k>0) and (s[k+1]<>s[i]) do k:=f[k]; if s[k+1]=s[i] then inc(k); f[i]:=k; end; k:=0; for i:=1 to 2*n do begin while (k>0) and (s[k+1]<>t[i]) do k:=f[k]; if s[k+1]=t[i] then inc(k); if k=n then begin result:=i+n; break; end; end; qqq:=result; end; begin readln(n); for i:=1 to n do read(s[i]); readln; for i:=1 to n do read(t[i]); for i:=1 to n do t[n+i]:=t[i]; writeln(qqq(s,t,n) mod n); end. Re: Why Compilation Error??? read FAQ. Q: I got Compilation Error, how can I learn why my program isn't compiled? A: If you choose "Reply to this E-Mail address" or "Reply to my E-Mail address" when submitting your solution, then report will be sent to selected e-mail address. In the case of Compilation Error a compilation log will be included in this report. Please, use this feature. |
|
|