|
|
back to boardI cannot get AC! This is my program: var t,total,k:longint; n,s:integer; procedure init; begin read(n,s); total:=0; k:=0; end; procedure work; var i:integer; begin for i:=9 downto 0 do if (total+i<=s div 2)and(k<=n) then begin inc(k); total:=total+i; if (total=s div 2)and(k=n) then inc(t) else work; total:=total-i; dec(k); end; end; procedure print; begin writeln(t*t); end; begin init; work; print; end. Use long arithmetic... :) Re: Use long arithmetic... :) Posted by Tang RZ 12 Jun 2004 18:43 What did you mean? I cannot get it! My English is poor! Because the largest answer can as large as 50 digits.But one longint just could handle up to 2147483647.It is only 10 digits. Posted by Y.Y.M. 13 Jun 2004 10:22 |
|
|