Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
把 cin=new Scanner(System.in); 放到循环外面试试。In Reply To:(java)为什么我的在自己的机器上没问题,但是提交通不过阿?(帮我看看) Posted by:nabber_jocelyn at 2006-07-21 16:40:13 > import java.io.*; > import java.util.*; > import java.text.DecimalFormat; > > > public class Main > { > public static void main(String args[]) > { > Scanner cin; > double read=0; > double result=0; > DecimalFormat format=new DecimalFormat("#0.##"); > > > > for(int count=1;count<=12;count++) > { > > cin=new Scanner(System.in); > > read=cin.nextDouble(); > result=result+read; > > } > System.out.print("$"+format.format(result/12)); > > > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator