'commit'
This commit is contained in:
18
TangDou/XiTi/1073.cpp
Normal file
18
TangDou/XiTi/1073.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user