Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为什么RE啊,各路大牛指教!

Posted by 826529615 at 2011-10-16 17:37:40 on Problem 1961
In Reply To:为什么RE啊,各路大牛指教! Posted by:826529615 at 2011-10-16 17:36:29
> 交了好几次,都RE.....
> var
>   n, tc: longint;
>   s: ansistring;
>   p: array[0..200010] of longint;
> 
> procedure init;
> var
>   i: longint;
> begin
>   readln(n);
>   if n = 0 then halt;
>   s := '';
>   readln(s);
> end;
> 
> procedure work;
> var
>   i, k, temp: longint;
> begin
>   fillchar(p,sizeof(p),0);
>   k := 0;
>   p[1] := 0;
>   for i := 2 to n do
>     begin
>       while (k > 0) and (s[i] <> s[k+1]) do k := p[k];
>       if s[i] = s[k+1] then inc(k);
>       p[i] := k;
>     end;
>   for i := 1 to n do
>     if p[i] <> 0 then
>       begin
>         temp := i-p[i];
>         if i mod temp = 0 then
>           writeln(i,' ',i div temp);
>       end;
> end;
> 
> begin
>   tc := 0;
>   while 1 = 1 do
>     begin
>       inc(tc);
>       init;
>       writeln('Test case #',tc);
>       work;
>       writeln;
>     end;
> end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator