LikeAC @ 2020-02-07 13:18:31
#include<bits/stdc++.h>
using namespace std;
int n,k,sum,m;
int main()
{
cin>>n;
n+=sum;
while(n>=k)
{
m=n%k;
n/=k;
sum+=n;
n+=m;
}
cout<<sum;
return 0;
}
再次表示感谢
by YosemiteHe @ 2020-02-07 13:20:04
@郝梓辰666 RE=Runtime Error=运行时错误
by JoaoFelix @ 2020-02-07 13:20:14
@郝梓辰666 orz,您下组数据试试看?
by 轮换对称式 @ 2020-02-07 13:21:11
@郝梓辰666
k没有赋值是0 n/0就RE
by 轮换对称式 @ 2020-02-07 13:22:44
@郝梓辰666
没有输入k
by YosemiteHe @ 2020-02-07 13:22:59
@郝梓辰666 您都没输入k
by YosemiteHe @ 2020-02-07 13:24:01
变量定义在main()外面自动初始化为0,n/0就会RE
by Sophon @ 2020-02-07 13:24:12
@郝梓辰666 没有输入k
by YosemiteHe @ 2020-02-07 13:25:36
每组测试数据一行包括两个整数
by YosemiteHe @ 2020-02-07 13:26:03
@郝梓辰666 学了两年的不算萌新啊qwq
by LikeAC @ 2020-02-07 13:28:36
后来我试了试,把k输进去了,于是全WA