编译器是对的,但提交是错的,大佬求助一下!!!

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

XZIT22090201124 @ 2022-10-18 16:50:10


#include <bits/stdc++.h>
using namespace std;
int main()
{   int n,k;
double sum1,sum2,a=0,b=0;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        if(i%k==0)
        {
            sum1+=i;
            a++;
        }

        else
        {
            sum2+=i;
            b++;

        }

    }
    cout<<fixed<<setprecision(1)<<sum1/a<<endl;
    cout<<fixed<<setprecision(1)<<sum2/b<<endl;     
    return 0;
}

by Vergil_Sparda @ 2022-10-18 16:54:54

@XZIT22090201124 两数之间是空格


by sizheng555 @ 2022-10-18 16:55:35

@XZIT22090201124 两数之间是空格


by chun_71 @ 2022-10-18 17:14:09

@qknb_QWQ 活捉大佬


by XZIT22090201124 @ 2022-10-18 22:21:00

@qknb_QWQ 谢谢


by XZIT22090201124 @ 2022-10-18 22:21:19

@sizheng555 谢谢


|