|
|
back to boardI've considered 0->10,but still got WA.Why?(program inside) Posted by Sam Koo 25 Mar 2002 12:36 program u1014; var n,u :longint; so :string; begin readln(n); if n=0 then begin writeln('10'); halt; end; so:=''; u:=9; while n>9 do begin while (n mod u<>0) and (u>1) do dec(u); if u=1 then begin writeln('?'); halt; end; so:=chr(48+u)+so; n:=n div u; end; so:=chr(48+n)+so; writeln(so); end. Try 20723 > program u1014; > > var > n,u :longint; > so :string; > > begin > readln(n); > if n=0 then begin > writeln('10'); > halt; > end; > so:=''; > u:=9; > while n>9 do begin > while (n mod u<>0) and (u>1) do dec(u); > if u=1 then begin > writeln('?'); > halt; > end; > so:=chr(48+u)+so; > n:=n div u; > end; > so:=chr(48+n)+so; > writeln(so); > end. > Re: Try 20723 Posted by Pazzl 2 Apr 2002 00:17 W.A. Because in thy algorithm instead of "?" It is necessary to remove "-1" If that write on Zintel@inbox.ru |
|
|