#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
int k;
cin >> n >> k;
double A[10000] = {0};
double B[10000] = {0};
int a = 0;
int b = 0;
for(int i = 1;i <= n;i++){
if (i % k == 0){
A[a++] = i;
}
else {
B[b++] = i;
}
}
double sum_a = 0;
for (int i = 0;i < a;i++){
sum_a = sum_a + A[i];
}
double sum_b = 0;
for (int i = 0;i < b;i++){
sum_b = sum_b + B[i];
}
double ra= sum_a / a;
double rb= sum_b / b;
cout << fixed<<setprecision(1)<<ra<<' '<<rb;
return 0;
}
洛谷 分类平均 P5719
最新推荐文章于 2024-09-02 13:43:09 发布