gordon321 @ 2023-08-03 16:00:46
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
cout<<n+n/k;
return 0;
}
by Tim_the_best @ 2023-08-03 16:17:16
万一数据是这个100 2 你的程序会输出什么(用计算器算一下)
by Tim_the_best @ 2023-08-03 16:18:43
求关注
by gordon321 @ 2023-08-03 16:18:49
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
cout<<n+(n-1)/(k-1);
return 0;
}
(n-1)/(k-1)是什么意思呀
by gordon321 @ 2023-08-03 16:23:35
?
by Tim_the_best @ 2023-08-03 16:27:56
因为k个烟蒂=1根烟+1个烟蒂
所以k-1个烟蒂=1根烟
注意减掉最后一根烟的烟蒂
by Tim_the_best @ 2023-08-03 16:28:17
@gordon321
by gordon321 @ 2023-08-03 16:28:53
我是** 谢谢
by Tim_the_best @ 2023-08-03 16:29:42
因为k个烟蒂=1根烟+1个烟蒂 换的那个会有一个烟蒂
by Tim_the_best @ 2023-08-03 16:30:02
求关注