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 |
runtime error为什么用java写的总是runtime error??? import java.text.DecimalFormat; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); long[] x; long[] y; int num; DecimalFormat df = new DecimalFormat("#.000000"); while(true){ num = in.nextInt(); x=new long[num]; y=new long[num]; StringBuffer sb = new StringBuffer(); sb.append(num+" "); for(int i = 0;i<num;i++){ x[i]=in.nextLong(); y[i]=in.nextLong(); } for(int i=0;i<num-1;i++){ sb.append(df.format((x[i]+x[i+1])/2)+" "); sb.append(df.format((y[i]+y[i+1])/2)+" "); } sb.append(df.format((x[0]+x[num-1])/2)+" "); sb.append(df.format((y[0]+y[num-1])/2)+"\n"); System.out.print(sb); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator