tuoran @ 2024-08-21 19:16:49
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
scanf("%d%d",&n,&k);
int Asum = 0,Bsum = 0;
cin>>n>>k;
for(int i=k;i<=n;i+=k)
Asum+=i;
Bsum = (1+n)*n/2-Asum;
printf("%.1lf",double(Asum)/(n/k));
printf("%.1lf",double(Bsum)/(n-n/k));
return 0;
}
by Dws_t7760 @ 2024-08-21 19:20:04
@tuoran 空格
by haimingbei @ 2024-08-21 19:20:56
@tuoran 哥,你空格呢??
by Scez @ 2024-08-21 19:23:28
@tuoran 哥你怎么输入了两遍
by Scez @ 2024-08-21 19:23:48
@tuoran
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
scanf("%d%d",&n,&k);
int Asum = 0,Bsum = 0;
int cnt=0;
for(int i=1;i<=n;i++)
{
if(i%k==0)
{
cnt++;
Asum+=i;
}
Bsum+=i;
}
Bsum-=Asum;
printf("%.1lf",double(Asum)/cnt);
cout<<" ";
printf("%.1lf",double(Bsum)/(n-cnt));
return 0;
}
by tuoran @ 2024-08-21 19:24:32
什么空格
by Scez @ 2024-08-21 19:24:49
@tuoran 两个答案之间
by Scez @ 2024-08-21 19:25:02
@tuoran 你都不看样例吗
by Scez @ 2024-08-21 19:25:34
@Scez
不过输入两遍似乎没影响
by Scez @ 2024-08-21 19:26:46
@tuoran 请输出这两类数的平均数,精确到小数点后1位,用空格隔开。
by tuoran @ 2024-08-21 19:27:36
哎呦我嘞个骚刚