shumu @ 2022-10-02 20:55:20
s = input().split()
N = int(s[0])
k = int(s[1])
new = N//k
new2 = new
while(new >= k):
new2 = new + (new // k)
new = new // k
print(N+new2)
by chengyunqi @ 2022-10-02 21:12:03
我只会c++
#include<iostream>
long long a,b,cnt;
int main()
{
std::cin>>a>>b;
while(a)
{
if(a<b)
{
cnt+=a;
break;
}
cnt+=a/b*b;
a=a-a/b*b+a/b;
}
std::cout<<cnt<<std::endl;
}
by chengyunqi @ 2022-10-02 21:13:14
@shumu
by shumu @ 2022-10-03 16:18:11
@chengyunqi 为什么cnt+=a/b*b
by YLXxxx @ 2022-10-03 16:34:47
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long i,n,k,b;
cin>>n>>k;
b=n;
while(n/k!=0)
{
n-=k;
n+=1;
b+=1;
}
cout<<b;
return 0;
}
by chengyunqi @ 2022-10-03 19:05:59
我就是这样做的呀。。。
by chengyunqi @ 2022-10-03 19:06:27
能AC不就得了吗
by Albatross_LC @ 2022-10-06 17:08:56
#include<bits/stdc++.h>
using namespace std;
int n,k,sum,ans;
int main(){
cin>>n>>k;//有n根烟,k个烟蒂可以换一根烟
while(n!=0){//如果有烟可吸就继续
n--,ans++,sum++;//每次吸一根烟,减少一根,烟蒂增加一根,吸的根数加1
if(ans==k)ans=0,n++;//如果可以换的话就换,烟蒂少k根,多了一根烟
}
cout<<sum;//烟吸完了,输出吸的个数
}
//重要的事情说三遍:
//吸烟有害健康,请勿尝试吸烟!
//吸烟有害健康,请勿尝试吸烟!
//吸烟有害健康,请勿尝试吸烟!
by tomatoANG @ 2023-05-04 19:42:09
@shumu python我会,我是三级小佬
by tomatoANG @ 2023-05-04 19:50:06
@shumu split里面要加东西
while(new >= k):
为什么要>=
再说了也不要循环