zhx21009100928 @ 2021-10-31 17:43:19
#include<stdio.h>
int main ()
{
int n,k;
scanf("%d %d",&n,&k);
int i;
int sum;
sum=0;
for(i=k;i<=n;i=i+k)
{
sum=sum+i;
}
int SUM;
SUM=n*(n+1)/2;
printf("%.1f %.1f",sum*k/n,(SUM-sum)/(n-(n/k)));
return 0;
}
by ud2_ @ 2021-10-31 17:54:07
main.c: In function 'main':
main.c:15:16: warning: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=]
15 | printf("%.1f %.1f",sum*k/n,(SUM-sum)/(n-(n/k)));
| ~~~^ ~~~~~~~
| | |
| double int
| %.1d
main.c:15:21: warning: format '%f' expects argument of type 'double', but argument 3 has type 'int' [-Wformat=]
15 | printf("%.1f %.1f",sum*k/n,(SUM-sum)/(n-(n/k)));
| ~~~^ ~~~~~~~~~~~~~~~~~~~
| | |
| double int
| %.1d
by zhx21009100928 @ 2021-10-31 18:10:16
@ud2_ 改对了 多谢多谢