ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1313. Some Words about Sport

Wrong answer(1),help!!!
Posted by zsyzYYK 7 Feb 2009 14:50
Wrong answer,why?????

var
  a:array[1..100]of longint;
  c,n,m,i,l,k,b,o,p:longint;
begin
  readln(n);
  if n=1
    then begin
           read(k);
           write(k,' ');
           exit;
         end;
  c:=0;m:=0;
  for i:=1 to n do
    begin
      repeat
        inc(c);inc(m);
        read(k);
        a[m]:=k;
      until c=n;
      c:=0;
    end;
  if n=2
  then begin
         write(a[1],' ',a[3],' ',a[2],' ',a[4],' ');
         exit;
       end;
  m:=1;
  for i:=1 to n do
    begin
      write(a[m],' ');
      b:=m;
      repeat
        if (b-n+1)>=(n-1)
          then write(a[b-n+1],' ');
        b:=b-n+1;
      until b<n-1;
      m:=m+n;
    end;
  c:=n*(n-1)+1;o:=0;
  for i:=n-1 downto 1 do
    begin
      inc(c);
      write(a[c],' ');
      l:=c;o:=i;
      if c=n*n
        then exit
        else repeat
               dec(o);
               if (c-n+1)>=(n-1)
               then write(a[c-n+1],' ');
               c:=c-n+1;
             until o=1;
      c:=l;
    end;
end.