25温 @ 2022-08-31 18:50:21
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, yd = 0, sum = 0;
cin >> n >> k;
sum += n;
while (n >= k) {
yd = n % k;
n /= 3;
sum += n;
}
cout << sum;
return 0;
}
by Nevergonna_CCF @ 2022-08-31 19:00:43
@25温
by Wei_Yue @ 2022-08-31 19:03:06
@25温 没考虑通过烟蒂换的烟的烟蒂还能换烟的情况
by 25温 @ 2022-08-31 19:04:54
@Wei_Yue 是的 修改中,谢谢
by 25温 @ 2022-08-31 19:05:09
@lmw_AK_noip 欧克
by Wei_Yue @ 2022-08-31 19:09:46
@25温 修改后代码
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, yd = 0,sum;
cin >> n >> k;
sum = n;
yd=sum;
while (yd>= k) {
yd=yd-k;
sum++;
yd++;
}
cout << sum;
return 0;
}
by 25温 @ 2022-08-31 19:14:31
@Wei_Yue 感谢,大佬犹如再生父母 /张嘴奶龙
by 25温 @ 2022-08-31 19:14:55
AC 已通过