brony @ 2018-11-26 22:18:50
by brony @ 2018-11-26 22:19:50
using namespace std;
int main()
{
int n,k,ans=0;
cin>>n>>k;
int b=n;
for(int i=1;i<=n;i++)
{
ans+=n/k;
n=n-ans*k+ans;
}
cout<<b+ans;
return 0;
}
by NaCly_Fish @ 2018-11-26 22:47:56
每次拿烟蒂换完烟,继续抽剩下的还能换
by brony @ 2018-11-27 18:00:58
@NaCly_Fish 大佬能帮改下代码嘛qwq
by NaCly_Fish @ 2018-11-27 18:01:26
@brony QAQ
by NaCly_Fish @ 2018-11-27 18:04:37
用个while循环模拟抽烟、换烟就好了
by brony @ 2018-12-01 12:12:55
@NaCly_Fish 靴靴小姐姐