zwb3_1415926 @ 2021-08-23 22:37:58
#include<bits/stdc++.h>
using namespace std;
int main()
{
double a1,b1,c,d;
int n1,k,n,n2,k1,b=0,a=0;
cin>>n>>k;
k1=k;
for (n1=1;n1<=n;n1++)
{
n2=n1;
if (n2%k1==0)
{
a=a+n1;
a1=a1+1;
}
else
b=b+n1;
}
b1=n-a1;
printf("%.1f %.1f",a/a1,b/b1);
return 0;
}
by 囧仙 @ 2021-08-24 08:17:21
by winniesun @ 2021-08-24 14:00:46
printf("%.1f %.1f",a/a1,b/b1);
"%.1f %.1f" 中间多了一个空格。
by zwb3_1415926 @ 2021-08-24 14:07:07
啊,手欠啊!!