Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
52688 teacher_wang 计算书费 C++ Accepted 0 MS 252 KB 501 2024-10-12 12:42:54

Tests(1/1):


#include <bits/stdc++.h> using namespace std; int main( ) { double a[10] = {28.9,32.7,45.6,78,35,86.2,27.8,43,56,65}; int n; //购买每本书的数量 double total=0; //总费用 for(int i=0;i<10;i++) { cin>>n; //输入i种书的个数 //scanf("%d",&n); total += n * a[i]; //累加计算总费用 } cout<<fixed<<setprecision(1)<<total; //printf("%.1lf",total); return 0; }


Judgement Protocol: