wa

P5719 【深基4.例3】分类平均

AC_kkk0926 @ 2023-12-14 20:45:24

#include <bits/stdc++.h>
using namespace std;
int a, s, i = 1;
double d = 0,f = 0;
int main() {
    cin >> a >> s;
    while (i <= a) {

        if (i % s == 0) {
            d = d + i;
        } else {
            f = f + i;

        }
    i++;
    }
    cout<<fixed<<setprecision(1)<<d/a<<" "<<fixed<<setprecision(1)<<f/a;

    return 0;
}

|