第三个错了

P1150 Peter 的烟

Curry_Skyfxxker @ 2022-07-13 21:15:21

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,cnt=0,sum=0;
    cin>>n>>k;
    cnt+=n;
    sum+=n;
    while(cnt>k){
        sum+=cnt/k;
        cnt=cnt/k+cnt%k;
    }
    cout<<sum;
    return 0;
}

by JASONYAN @ 2022-07-13 21:29:40

将代码的第八行改成

while(cnt>=k)

by Curry_Skyfxxker @ 2022-07-13 21:32:49

@JASONYAN 谢谢阿哥


by JASONYAN @ 2022-07-13 21:37:08

No thanks.


by zlinda @ 2022-09-17 17:37:20

@JASONYAN 我和他一个错误,谢谢


|