HDU 2092 The price of the dish (end condition, pit!)

Source: Internet
Author: User

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!)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.