hdu 2090 算菜价

时间:2015-05-30 01:49:26   收藏:0   阅读:309

代码:

#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    char str[100];
    double p,q;
    double ans=0;
    while(~scanf("%s%lf%lf",str,&p,&q))
    {
        ans=ans+p*q;
    }
    printf("%.1lf\n",ans);//自动会四舍五入
    return 0;
}


原文:http://blog.csdn.net/xky1306102chenhong/article/details/46247787

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!