救命,为啥第一个输出结果是f?

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

ElonaSerikas @ 2021-09-23 14:33:07

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double a;
    int n,k;
    cin >> n >> k;
    for (int i = k ; i <= n ; i += k){
        a += i;
    }
    printf("%.if",a / (n / k));
    a = (1 + n) * n / 2 - a;
    printf("%.1f",a / (n - (n / k)));
    return 0;
} 

by 蔡鸟bird @ 2021-09-23 14:40:46

%.if

|