liumingdi @ 2024-09-17 09:50:46
#include <iostream>
using namespace std;
void smoke(int &tobacco, int &cb, int k) {
int new_tobacco = cb / k;
int new_cb = new_tobacco;
int tobacco_sum = tobacco + new_tobacco;
tobacco = tobacco_sum;
cb = new_cb;
}
int main() {
int n, k;
cin >> n >> k;
int cb = n;
while (cb > 0) {
smoke(n, cb, k);
}
cout <<n;
return 0;
}
cb是烟蒂 求助第三个WA了
by luoyiwen @ 2024-09-17 10:13:07
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
cout<<n+(n-1)/(k-1);
return 0;
}
求关