蒟蒻求助,为什莫全错?

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

lmxasgy @ 2021-01-23 20:40:21

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    double sum;
    cin >> n >> k;
    for (int i = k; i <= n; i += k) sum += i;
    cout << setiosflags(ios::fixed);
    cout << setprecision(1) << sum / (n / k);
    sum = (1 + n) * n / 2 - sum;
    cout << setiosflags(ios::fixed);
    cout << setprecision(1) << sum / (n - n / k);
    return 0;
}

by feicheng @ 2021-01-23 20:44:44

您没打空格

您都绿名了怎么害在做这种水题啊?


by BotDand @ 2021-01-23 20:59:02

您不测样例的吗


by lmxasgy @ 2021-01-24 17:03:16

@飞丞 跪谢 还不是自己太菜,普及-都没做多少


by lmxasgy @ 2021-01-24 17:05:27

@飞丞 真正的蒟蒻在这里


|