w_y_c @ 2016-08-27 10:25:28
#include<cstdio>
int main()
{
int n,k;
int nx=0;//能吸的烟
int yd=0;//烟蒂
scanf("%d%d",&n,&k);
nx=n+n/k;
yd=n-n/k*k;
while(yd>k-1)
{
nx+=yd/k;//能吸的
yd=yd-yd/k*k+yd/k;
}
if(yd==k-1)//借一个 然后吸了 再换 再还
nx++;
printf("%d\n",nx);
return 0;
}
by yxq123456789 @ 2016-08-27 12:33:43
var
n,i,k,m,s,l,mm:longint;
begin
read(n,k);
m:=n;
mm:=n;
l:=0;
while m>=k do begin
mm:=mm+m div k;
m:=(m div k)+l;
l:=m mod k;
end;
write(mm);
end.
by w_y_c @ 2016-08-27 20:38:48
@ yxq123456789
同学我没明白你在说什么。。。
by EnderBracket @ 2016-08-31 15:10:01
不能借吧
by EnderBracket @ 2016-08-31 15:10:50
看第1个数据
by EnderBracket @ 2016-08-31 15:19:04
实测不能借,把借一个吸的那句删了
by 2bsb2b @ 2016-10-07 14:26:15
#include <iostream>
using namespace std;
int n,k,s;
int main()
{
cin>>n>>k;
s=n;
while (n>=k)
{
n=n-k+1;
s+=1;
}
cout<<s;
return 0;
}
by CrTsIr400 @ 2021-01-18 07:20:15