Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:哪位高手帮我看看程序吧In Reply To:哪位高手帮我看看程序吧 Posted by:richardhuang at 2004-05-27 17:08:06 program fasd; var num:longint; i,j,k,l:longint; min:longint; begin readln(num); while num>0 do begin min:=maxlongint; for i:=0 to trunc(exp(ln(10*num)/3)) do begin k:=trunc(i*(i+1)*(i+2)/6); if k<=num then begin if k=num then begin min:=0; end else begin j:=trunc(exp(ln(num-k)/3)); l:=num-k-j*j*j; if l<min then min:=l; end; end; end; writeln(num-min); readln(num); end; end. Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator