90?

B2088 计算书费

wangjingxi_ @ 2024-07-28 19:41:56


#include<bits/stdc++.h>
using namespace std;
double a[10]={28.9,32.7,45.6,78,35,86.2,27.8,43,56,65};
int main()
{
    double x,ans=0;
    for(int i=1;i<=10;i++){
        cin>>x;
        ans+=a[i-1]*x;
    }
    cout<<ans;
}

by jntmhh @ 2024-07-28 19:44:08

用printf行吗(不知道行不行)


by jntmhh @ 2024-07-28 19:44:31

@wangjingxi_


by jntmhh @ 2024-07-28 19:46:34

是 #5wa了吗


by wangjingxi_ @ 2024-07-28 19:47:32

啊?过了?谁能解释一下?


by jntmhh @ 2024-07-28 19:48:02

我也不知道


by jntmhh @ 2024-07-28 19:48:55

精确到小数点后一位 @wangjingxi_


by jntmhh @ 2024-07-28 19:49:33

cout应该是四舍五入吧


by wangjingxi_ @ 2024-07-29 08:28:40

6


by wangjingxi_ @ 2024-07-29 08:28:55

关了


by Shenyufan13 @ 2024-08-10 22:06:23

#include<bits/stdc++.h>
using namespace std;
double a[10]={28.9,32.7,45.6,78,35,86.2,27.8,43,56,65};
int main()
{
    double x,ans=0;
    for(int i=1;i<=10;i++){
        cin>>x;
        ans+=a[i-1]*x;
    }
    cout<<fixed<<setprecision(1)<<ans;
}

把你代码改了改,A了,求关~(你的关我要定了)~


| 下一页