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 1319. Hotel

WA #4 need help....
Posted by Swifty 15 Mar 2009 13:11
var a:array [1..100,1..100] of byte;
    i,j,n,x,y,k:byte;
begin
  readln(n);
  x:=1;
  a[1,n]:=x;
  inc(x);
  for j:=n-1 downto 1 do
    begin
      i:=1;
      k:=j;
      while k<=n do
        begin
          a[i,k]:=x;
          inc(x);
          inc(i);
          inc(k);
        end;
    end;
  for i:=2 to n do
    begin
      j:=1;
      k:=i;
      while k<=n do
        begin
          a[k,j]:=x;
          inc(x);
          inc(k);
          inc(j);
        end;
    end;
  for i:=1 to n do
    begin
      for j:=1 to n do
        write(a[i,j],' ');
      writeln;
    end;
  readln;
end.
Re: WA #4 need help....
Posted by Swifty 15 Mar 2009 13:16
Got it AC now.... Just changed from byte to integer.