我的程序只有90分,第三点超时了。

P1150 Peter 的烟

ckyao1881 @ 2016-08-16 13:55:27

var
  n,i,j,m,k:longint;
begin
  readln(n,k);
  m:=n;
  repeat
  if n>k then begin
  m:=n div k+m;
  n:=n div k+n mod k;
  end;
  until n<k;
  writeln(m);
end.

by 1124828077ccj @ 2016-08-16 16:10:01

@ckyao1881 然而你已经 # AC 了


by ckyao1881 @ 2016-08-16 16:15:35

what


by ckyao1881 @ 2016-08-16 16:16:06

什么意思,我是用pascal的


by yuzoe @ 2016-08-16 20:05:41

until n<k;

writeln(m);

改为 until n>=k;

writeln(m);


by littlep001 @ 2024-10-03 11:45:47

考古


|