hp1596321 @ 2023-03-19 22:18:02
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int n = 0;
int k = 0;
scanf("%d%d", &n, &k);
int x = 0;
float s1 = 0;
float s2 = 0;
int count1 = 0;
int count2 = 0;
for (int i = 1; i < n+1; i++)
{
if (i%k == 0)
{
count1++;
s1 = s1 + i;
}
else
{
count2++;
s2 = s2 + i;
}
}
printf("%.1lf %.1lf", s1 / count1, s2 / count2);
/*printf("%.1lf %.1lf", s1*1.0 / count1, s2*1.0 / count2);*/
return 0;
}
by tangguo_yyds @ 2023-03-19 22:31:08
@hp1596321 ?把float全部改成double不满分了吗?