QK568 @ 2018-02-05 20:53:36
using namespace std; long long n,k,liu,n1,ans=0; int main() { cin>>n>>k; n1=n; ans+=n; while(n1>k) { ans+=n1/k; liu=n1%k+n1/k; n1=liu; } cout<<ans; }
by Mike_Nancy @ 2018-03-06 16:39:48
因为您没有考虑n1=k的情况,就是while循环的条件应该是while(n1>=k)