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

Why error on test 2? Where is mistake?
Posted by kronos_vano 10 Jul 2005 23:15
var  a:array[1..100,1..100]of longint;
     k,cc,ii,jj,ic,n,i,j,numb:longint;
begin
  readln(n);
  for i:=1 to n do
  begin
    for j:=1 to n-1 do
      read(a[i,j]);
    readln(a[i,j+1]);
  end;
  cc:=1;ic:=1;i:=1;j:=1;numb:=1;
  while numb<=n*n do
  begin
    ii:=i;jj:=j;
    for k:=1 to cc do
    begin
      write(a[ii,jj],' ');
      inc(numb);
      dec(ii);
      inc(jj);
    end;
    inc(i);
    if i>n then
    begin
      i:=n;
      inc(j);
    end;
    if cc> (N*2-1) div 2
    then ic:=-1;
    inc(cc,ic);
  end;
end.