xiaoxiaozou886 @ 2021-12-26 08:37:23
#include<bits/stdc++.h>
using namespace std;
int a,b,sum,ssum;
int main(){
cin>>a>>b;
for(;;){
ssum=ssum+a/b;
a=a/b+a%b;
if(a<4)
break;
}
cout<<ssum+10;
}
by 3a51_ @ 2021-12-26 08:41:08
判断条件应该是
by 3a51_ @ 2021-12-26 08:45:04
你试试这个
#include<bits/stdc++.h>
using namespace std;
int a,b,sum,ssum;
int main(){
cin>>a>>b;
ssum=a;//最初的a根烟
for(;;){
ssum=ssum+a/b;
a=a/b+a%b;
if(a<b)
break;
}
cout<<ssum;
}