初音のミク @ 2020-08-20 16:23:34
为啥10和3输出14?不是13?
by 初音のミク @ 2020-08-20 16:48:05
while第二,三个点变成了tle。。。
by 零殇 @ 2020-08-20 16:51:03
@初音のミク
emmmm,源代码?
by 初音のミク @ 2020-08-20 16:55:19
#include <iostream>
using namespace std;
int main( )
{
int n,k,ans,tmp=0,b;
cin>>n>>k;
ans=n/k;
b=ans/k;
cout<<n+ans+tmp+b;
return 0;
}
by 零殇 @ 2020-08-20 17:00:42
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int k,ans,n,tmp;
cin>>n>>k;
x=n;
while(n>=k)
{
ans+=n/k;
tmp=n/k;
n=n%k;
n+=tmp;
}
cout<<ans;
return 0;
}
请不要在乎那些罗里吧嗦的库头
by 零殇 @ 2020-08-20 17:01:16
@初音のミク
by 零殇 @ 2020-08-20 17:01:56
不好意思,请把x改成ans
by 初音のミク @ 2020-08-20 17:03:13
谢了大佬,AC了(其实我用cout<<n+(n-1)/(k-1)AC过一次了,但是还想改过来)
by 初音のミク @ 2020-08-20 17:04:12
我觉得头文件不用打这么多。。。