HDU 2090

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2090

Windows下的EOF结束符为Ctrl + Z

代码如下:

 1 #include <cstdio>
 2 using namespace std;
 3 
 4 int main()
 5 {
 6     double num, price;
 7     char s[20];
 8     double sum = 0;
 9     while(scanf("%s %lf %lf", s, &num, &price) != EOF)
10     {
11              sum += num * price;                           
12     }
13     printf("%.1lf\n", sum);
14     return 0;    
15 }
posted @ 2012-08-18 21:17  山路水桥  阅读(333)  评论(0编辑  收藏  举报