| ||||||||||
| 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 | |||||||||
why RE??? 请教大牛~~~program pku2509(input, output);
VAR sum, n, k: longint;
BEGIN
while not eof do
begin
read(n, k);
sum:=n;
while n>=k do
begin
sum:=sum+ (n DIV k);
n:= (n MOD k) + (n DIV k) ;
end;
writeln(sum);
end;
END.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator