19 lines
415 B
C++
19 lines
415 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
float price[10] = {28.9, 32.7, 45.6, 78, 35, 86.2, 27.8, 43, 56, 65};
|
|
float total = 0;
|
|
for (int i = 0; i < 10; ++i) {
|
|
int a;
|
|
cin >> a;
|
|
total += price[i] * a;
|
|
}
|
|
//C语言写法
|
|
printf("%.1f\n", total);
|
|
//C++写法
|
|
cout << fixed << setprecision(1) << total << endl;
|
|
return 0;
|
|
}
|