Fork me on GitHub

NYOJ之算菜价

------------------------------------------------------

AC代码:

 1 import java.io.BufferedReader;
 2 import java.io.IOException;
 3 import java.io.InputStreamReader;
 4 
 5 public class Main {
 6 
 7     public static void main(String[] args) throws IOException {
 8         
 9         BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
10         
11         double ans=0;
12         boolean first=true;
13         while(first || reader.ready()){
14             first=false;
15             String ss[]=reader.readLine().split("\\s{1,}");
16             ans+=Double.parseDouble(ss[1])*Double.parseDouble(ss[2]);
17         }
18         System.out.printf("%.1f",ans);
19         
20     }
21     
22 }

 

题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=316

posted @ 2016-08-21 10:38  CC11001100  阅读(307)  评论(0编辑  收藏  举报