|
|
вернуться в форумHelp Wa3 My program Wa3 This is my program: program Ural683; var a,m,n:longint; k:array[0..50]of longint; begin readln(n); m:=1; k[0]:=n; while k[m-1]<>0 do begin k[m]:=k[m-1]shr 1; inc(m); end; m:=0; a:=1; while a<n do begin inc(m);a:=a shl 1; end; writeln(m); for a:=1 to m do if k[a]=0 then write(1,' ') else write(k[a],' '); end. Who can help me? Edited by author 02.04.2009 14:18 Re: Help Wa3 Now I am AC!!! program Ural683; var a,m,n:longint; k:array[0..50]of longint; begin readln(n); m:=0; while n<>1 do begin inc(m); n:=n-n shr 1; k[m]:=n; end; writeln(m); for a:=1 to m do write(k[a],' '); end. |
|
|