bacfdml @ 2024-12-21 11:35:44
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k,e=1,d=1;
double a=0,b=0;
cin>>n>>k;
for(int i=1;i<=n;i++)
{
if(i%k==0)
{
a+=i;
e++;
}
else
{
b+=i;
d++;
}
}
a/=e;
b/=d;
printf("%.1lf %.1lf",a,b);
return 0;
}
by llh2012 @ 2024-12-21 11:48:10
我勒个 a/=e b/=d
by SuperBeetle @ 2024-12-21 11:48:38
e = 0, d = 0
by SuperBeetle @ 2024-12-21 11:48:54
@bacfdml
by bacfdml @ 2024-12-21 11:52:35
@SuperBeetle谢谢