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 1067. Disk Tree

Give me a hand.I get WA...
Posted by Pooya 8 Mar 2003 18:49
if you can't read my program so
help me by some tricky tests.

this is my program :

const
  max           =500;
var
  a             :array[1..max]of string[81];
  sw,wrd        :string[81];
  i,j,k,n,num   :longint;

begin
  readln(n);
  for I:=1 to N do
  begin
    readln(a[i]);a[i]:=a[i]+'\';
    for j:=1 to length(a[i]) do
      if a[i][j]='\' then
        a[i][j]:=' ';
  end;
  writeln;
  {sorting}
  for I:=1 to N do
    for J:=I+1 to N do
      if a[i]>a[j] then
      begin
        sw:=a[i];a[i]:=a[j];a[j]:=sw;
      end;

  num:=0;
  for i:=1 to length(a[1]) do
  begin
    if a[1][i]=' ' then
    begin
      for j:=1 to num do write(' ');
      writeln(wrd);
      inc(num);
      wrd:='';
    end
    else
      wrd:=wrd+a[1][i];
  end;

  wrd:='';
  for I:=2 to N do
  begin
    num:=0;
    for j:=1 to length(a[i]) do
    begin
      if a[i][j]<>a[i-1][j] then break;

      if a[i][j]=' ' then
      begin
        wrd:='';
        inc(num);
      end
      else
        wrd:=wrd+a[i][j];
    end;

    for K:=j to length(a[i]) do
    begin
      if a[i][k]=' ' then
      begin
        for j:=1 to num do write(' ');

        if (k=length(a[i]))and(i=n) then
          write(wrd+' ')
        else
          writeln(wrd);
        inc(num);
        wrd:='';
      end
      else
        wrd:=wrd+a[i][k];
    end;
  end;
end.

Pooya
{pooyahat@yahoo.com}
Re: Give me a hand.I get WA...
Posted by Nazg 9 Mar 2003 15:53
> if you can't read my program so
> help me by some tricky tests.
>
> this is my program :
>
> const
>   max           =500;
> var
>   a             :array[1..max]of string[81];
>   sw,wrd        :string[81];
>   i,j,k,n,num   :longint;
>
> begin
>   readln(n);
>   for I:=1 to N do
>   begin
>     readln(a[i]);a[i]:=a[i]+'\';
>     for j:=1 to length(a[i]) do
>       if a[i][j]='\' then
>         a[i][j]:=' ';
>   end;
>   writeln;
>   {sorting}
>   for I:=1 to N do
>     for J:=I+1 to N do
>       if a[i]>a[j] then
>       begin
>         sw:=a[i];a[i]:=a[j];a[j]:=sw;
>       end;
>
>   num:=0;
>   for i:=1 to length(a[1]) do
>   begin
>     if a[1][i]=' ' then
>     begin
>       for j:=1 to num do write(' ');
>       writeln(wrd);
>       inc(num);
>       wrd:='';
>     end
>     else
>       wrd:=wrd+a[1][i];
>   end;
>
>   wrd:='';
>   for I:=2 to N do
>   begin
>     num:=0;
>     for j:=1 to length(a[i]) do
>     begin
>       if a[i][j]<>a[i-1][j] then break;
>
>       if a[i][j]=' ' then
>       begin
>         wrd:='';
>         inc(num);
>       end
>       else
>         wrd:=wrd+a[i][j];
>     end;
>
>     for K:=j to length(a[i]) do
>     begin
>       if a[i][k]=' ' then
>       begin
>         for j:=1 to num do write(' ');
>
>         if (k=length(a[i]))and(i=n) then
>           write(wrd+' ')
>         else
>           writeln(wrd);
>         inc(num);
>         wrd:='';
>       end
>       else
>         wrd:=wrd+a[i][k];
>     end;
>   end;
> end.
>
> Pooya
> {pooyahat@yahoo.com}
>




Test.
3
HAHA\TEST
ITWONTWORK
HAHA
Re: Give me a hand.I get WA...
Posted by Pooya 10 Mar 2003 17:44
thank you for laughing at me
but i got AC before your Haha

pooya
pooyahat@yahoo.com

> > if you can't read my program so
> > help me by some tricky tests.
> >
> > this is my program :
> >
> > const
> >   max           =500;
> > var
> >   a             :array[1..max]of string[81];
> >   sw,wrd        :string[81];
> >   i,j,k,n,num   :longint;
> >
> > begin
> >   readln(n);
> >   for I:=1 to N do
> >   begin
> >     readln(a[i]);a[i]:=a[i]+'\';
> >     for j:=1 to length(a[i]) do
> >       if a[i][j]='\' then
> >         a[i][j]:=' ';
> >   end;
> >   writeln;
> >   {sorting}
> >   for I:=1 to N do
> >     for J:=I+1 to N do
> >       if a[i]>a[j] then
> >       begin
> >         sw:=a[i];a[i]:=a[j];a[j]:=sw;
> >       end;
> >
> >   num:=0;
> >   for i:=1 to length(a[1]) do
> >   begin
> >     if a[1][i]=' ' then
> >     begin
> >       for j:=1 to num do write(' ');
> >       writeln(wrd);
> >       inc(num);
> >       wrd:='';
> >     end
> >     else
> >       wrd:=wrd+a[1][i];
> >   end;
> >
> >   wrd:='';
> >   for I:=2 to N do
> >   begin
> >     num:=0;
> >     for j:=1 to length(a[i]) do
> >     begin
> >       if a[i][j]<>a[i-1][j] then break;
> >
> >       if a[i][j]=' ' then
> >       begin
> >         wrd:='';
> >         inc(num);
> >       end
> >       else
> >         wrd:=wrd+a[i][j];
> >     end;
> >
> >     for K:=j to length(a[i]) do
> >     begin
> >       if a[i][k]=' ' then
> >       begin
> >         for j:=1 to num do write(' ');
> >
> >         if (k=length(a[i]))and(i=n) then
> >           write(wrd+' ')
> >         else
> >           writeln(wrd);
> >         inc(num);
> >         wrd:='';
> >       end
> >       else
> >         wrd:=wrd+a[i][k];
> >     end;
> >   end;
> > end.
> >
> > Pooya
> > {pooyahat@yahoo.com}
> >
>
>
>
>
> Test.
> 3
> HAHA\TEST
> ITWONTWORK
> HAHA
Damet ke i`ideye aslie barname ro loo dadi.
Posted by Locomotive 10 Mar 2003 18:11
???
Posted by Saber 11 Mar 2003 22:06
Please write in English just !!!
The test it wrong. ITWONTWORK exceeds 8 characters.
Posted by Maigo Akisame 11 Jun 2004 15:51