Calculate the price of the dishTime
limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 20479 Accepted Submission (s): 10819
Problem description mother every day to go out to buy vegetables, but back, pocket money also too lazy to count a number, in the end spent a lot of money really a silly account. Now, as a good son (daughter) you can give her a program to calculate, hehe.
Input inputs contain a number of data sets, each set of data including the type of food (string), the quantity (unit of measurement regardless of the double type) and the unit price (double number, the yuan number), therefore, the price per group of data is the number of the price. There are spaces between the dishes, the quantity and the unit price.
Output pay the price of the dish, because the minimum payment unit is the angle, so always at the time of payment by rounding method to remove the split. Finally, please output the total price of the dish with a precision of angle.
Sample Input
Green vegetables 1 2 Luo bu 2 1.5 chicken leg 2 4.2
Sample Output
13.4
Authorqianneng
Source greets new semester-super easy version
original title link: http://acm.hdu.edu.cn/showproblem.php?pid=2090
Water title: End condition is CTRL + ZWhen the array is small, it will WA!!!!
AC Code:
#include <iostream> #include <cstdio>using namespace Std;int main () { double sum=0; Char a[50]; Double x, y; while (Cin>>a>>x>>y) { sum+=x*y; } printf ("%.1f\n", sum); return 0;}
HDU 2092 The price of the dish (end condition, pit!)