修改后为什么仍然90分?!。。。

P1150 Peter 的烟

AnCcat @ 2017-06-16 21:22:10

var
n,k,s:longint;
begin
readln(n,k);
s:=n;
while n>=k do
begin
s:=s+n div k; 
n:=n div k+k mod n;
end;
writeln(s);
end.
求p党大神指点。。。

by Ice_teapoy @ 2017-06-26 08:28:01

var
n,k,s:longint;
begin
readln(n,k);
s:=n;
while n>=k do
begin
s:=s+1; 
n:=n-k+1;
end;
writeln(s);
end.

by Ice_teapoy @ 2017-06-26 08:35:00

n:=n div k+k mod n;

当 n>k 时 k mod n 是 k 吧?


|