90分萌新求助

P1150 Peter 的烟

Old_fox @ 2018-07-08 09:45:32

include<bits/stdc++.h>

using namespace std; int y(int a,int b) { int n; if(a<b) return a; else n=a; a=a/b; return n+y(a,b); } int main() { int n,k; cin>>n>>k; cout<<y(n,k); return 0; }


by Thor_Odinson @ 2018-07-24 16:25:39

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    cout<<n+(n-1)/(k-1);
    return 0;
}

上一页 |