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

WHY WA ?????????????????????
Posted by vano_B1 15 Jul 2003 22:25
type
  strpath=string[80];
var
   a:array [1..500] of strpath;
   n,i,j,ind,l:integer;
   min,pr:strpath;
   cb,sn:array[1..80] of strpath;


procedure wr(tp:strpath);
var
 k,nc,h,g:integer;
 db:boolean;
begin
nc:=1;
k:=1;
for h:=1 to length(tp) do
  if tp[h]='\' then begin
  sn[k]:=copy(tp,nc,h-nc);
  inc(k);
  nc:=h+1;
  end;
sn[k]:=copy(tp,nc,length(tp)-nc+1);

g:=1;
db:=false;
for h:=1 to k do
      if sn[h]<>cb[h] then begin
      g:=h;
      db:=true;
      break;
      end;
if db=true then
  for h:=g to k do
       writeln(copy(pr,1,h-1),sn[h]);
cb:=sn;
l:=k;
end;

procedure swapstr(var a1,b1:strpath);
var
 d:strpath;
begin
d:=a1;
a1:=b1;
b1:=d;
end;

begin
readln(n);
pr:='
   ';
for i:=1 to n do readln(a[i]);

for i:=1 to n-1 do begin
ind:=i;
min:=a[i];
for j:=i+1 to n do
    if min>a[j] then begin
       min:=a[j];
       ind:=j;
    end;
swapstr(a[i],a[ind]);
end;
l:=0;
for i:=1 to n do begin
wr(a[i]);
end;


end.