LinGxIao_0230 @ 2020-03-31 16:42:08
Why did I TLE?
by LinGxIao_0230 @ 2020-03-31 16:42:41
#include<bits/stdc++.h>
using namespace std;
long long n,k;
int main()
{
scanf("%d%d",&n,&k);
long long h=(1+n)*n/2,s=0,ji=0;
for(int i=k;i<=n;i+=k)
{
s+=i,ji++;
}
printf("%.1lf %.1lf",s/double(ji),(h-s)/double(n-ji));
return 0;
}
by LinGxIao_0230 @ 2020-03-31 16:43:25
为啥我超时了
by LinGxIao_0230 @ 2020-03-31 16:43:54
各位路过的大佬给个解答吧
by HearTheWindSing @ 2020-03-31 16:45:23
@蒟蒻_is_me 不是过了吗
by asasas @ 2020-03-31 16:45:39
@蒟蒻_is_me 您直接枚举就过了啊
by LinGxIao_0230 @ 2020-03-31 16:46:07
@wangyxhaha 同样的代码第一次超时了第二次过了
by Toclhu @ 2020-03-31 16:46:25
@蒟蒻_is_me 玄学
by LinGxIao_0230 @ 2020-03-31 16:46:42
我只想知道为什么一样的代码不同的结果
by Toclhu @ 2020-03-31 16:47:53
@蒟蒻_is_me 测评姬卡了?
by HearTheWindSing @ 2020-03-31 16:47:53
@蒟蒻_is_me 代码应该不一样吧,我没做这题,但我看你的使用空间都有变化