难道不能借一根然后还回去吗

P1150 Peter 的烟

王学迟 @ 2021-08-14 17:56:59

}```cpp

include <iostream>

using namespace std;

int main() { int n, k; cin >> n >> k; int num = 0; int left = 0; num = n; left = n; do { num += left / k; n = left / k; left = left - n * k + n; cout << num << " " << left << endl; } while (left >= k); if (k - left == 1) { num += 1; } cout << num; return 0; }


by shiwei06232 @ 2021-08-14 17:58:39

让你借了吗


by Leonid @ 2021-08-14 17:59:04

这不是小学奥数


by hanyuchen2019 @ 2021-08-14 17:59:50

望丰展?使Md


by Sol1 @ 2021-08-14 18:04:31

这不是小学奥数


by sss_t @ 2021-08-14 18:07:25

#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int k;
    cin>>k;
    cout<<n+(n-1)/(k-1);
}  

|