求助!!!第三点过不了!出了什么BUG???

P1150 Peter 的烟

Reveno @ 2019-10-02 00:21:13

include<bits/stdc++.h>

using namespace std; long long n,k,num; long long c(long long m) { if(m/k>0) { num+=m/k; return c(m/k); } else return num; } int main() { cin>>n>>k; num=n; cout<<c(n); }


by Zenurik @ 2019-10-02 08:42:17

希更展?用MD


by 只以 @ 2019-10-02 09:50:08

#include<bits/stdc++.h>
using namespace std;
long long n,k,num;

long long c(long long m){
    if(m/k>0){
        num+=m/k;
        return c(m/k);
    }
    else
        return num;
}

int main(){
    cin>>n>>k;
    num=n;
    cout<<c(n);
    return 0; 
}

蛋疼的窝来帮lz整理一下


by Reveno @ 2019-10-02 10:43:23

@只以 好像还是过不了...加return 0和不加都没太大的关系吧


by Reveno @ 2019-10-02 10:49:40

@只以 过了过了


by Reveno @ 2019-10-02 10:50:53

@只以 我忘了烟蒂可以累积```

include<bits/stdc++.h>

using namespace std; long long n,k,num; long long c(long long m) { if(m/k>0) { num+=m/k; return c(m/k+m-m/k*k); } else return num; } int main() { cin>>n>>k; num=n; cout<<c(n); }


by 只以 @ 2019-10-02 16:02:50

@Reveno 窝只是整理加改善码风


by syanoeclipse @ 2020-07-10 16:16:59

你这码风不怎么样啊

我也蛋疼

include<bits/stdc++.h>
using namespace std;
long long n,k,num;
long long c(long long m)
{ if(m/k>0)
{ num+=m/k; return c(m/k+m-m/k*k); }
else return num;
} int main() 
{ cin>>n>>k; num=n; cout<<c(n); }

|