Eval1024 @ 2022-04-06 10:22:06
#include<stdio.h>
int main()
{
int n,k;
scanf("%d%d",&n,&k);
int p=0,l=0;
float a=0.0,b=0.0;
for(int i=1;i<=n;i++)
if(i%k==0)
{ a+=i;
p++;
}
else
{ b+=i;
l++;
}
printf("%.1f %.1f",a/p,b/l);
return 0;
}
为啥就40分啊
by Mzk2333 @ 2022-04-06 10:23:31
定义成 double
试试
by Eval1024 @ 2022-04-06 10:26:36
@Afb_zs_dy 可以了,谢谢大佬