Sky_Aurora @ 2024-04-30 10:50:42
蒟蒻求助,样例3TLE了:
#include<iostream>
using namespace std;
int main()
{
int n,k;
cin >> n >> k;
int tmp = n;
while(tmp / k != 0)
{
n += tmp / k;
tmp = tmp / k;
tmp += tmp - tmp / k * k;
}
cout << n << endl;
return 0;
}
by laozhang_123 @ 2024-04-30 12:26:03
#include<iostream>
using namespace std;
int main(){
int a,b,c=0,d=0;
cin>>a>>b;
while(a!=0){
a--;
c++;
if(c==b){
c=0;
a++;}
d++;}
cout<<d<<endl;
}