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 1506. Columns of Numbers

help!!!!!
Posted by zsyzhbc_china 22 May 2009 11:48
program t1506;
var
  n,m,a,b,c,i,j,l:integer;
  k,o:real;s:string;
  h:array [1..100] of integer;
  q:array [1..10,1..10] of integer;
  p:array [1..10,1..10] of integer;
begin
  readln(n,k);
  for i:=1 to n do
  read(h[i]);
  m:=trunc(sqrt(n));
  if frac(sqrt(n))<>0 then inc(m);
  for i:=1 to m do
  for j:=1 to m do
  begin
    inc(b);
    p[i,j]:=h[b];
    str(h[b],s);
    q[i,j]:=length(s);
    if q[i,j]>a then a:=q[i,j];
  end;
  for i:=1 to m do
  for j:=1 to m do
  begin
      write(' ');
      for b:=1 to (a-q[j,i]) do write(' ');
    if j<>m then
    begin
      write(p[j,i]);
      inc(l);
    end
    else
    begin
      writeln(p[j,i]);
      inc(l);
    end;
    if l=n then halt;
  end;
end.

Edited by author 03.03.2010 10:22