|
|
вернуться в форумWho can help me with my codes? program ex; const max=100; var j,st,z,ch,n,i:integer; gh:array[1..max,1..max]of boolean; flag:boolean; ans:array[1..max]of integer; begin z:=1; fillchar(gh,sizeof(gh),false); { assign(input,'d:\input.txt'); reset(input);} readln(n); for i:=1 to n do begin read(ch); if ch=0 then begin writeln(0); halt; end; while ch<>0 do begin gh[i,ch]:=true; gh[ch,i]:=true; read(ch); end; readln; end; { close(input);} st:=1; ans[z]:=st; flag:=true; while st<n do begin j:=st+1; while gh[st,j]=true do j:=j+1; if j>n then break; z:=z+1; ans[z]:=j; st:=j; end; writeln(z); for i:=1 to z do write(ans[i],' '); writeln; end. |
|
|