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 |
各位大侠看下这个为什么会RE。。。。import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner cin = new Scanner(System.in); int num=0,index=0,n=0,i=0,pre=0,min=1000000000; n = cin.nextInt();pre=cin.nextInt(); for(i = 2;i < n - 1; i++){ num = cin.nextInt(); if(num-pre<min){ min = num-pre; index = i; } pre = num; } pre = cin.nextInt(); if(n >= 4){ System.out.println(min+pre); System.out.printf("%d 1 %d %d\n",index + 1, n, index); }else{ System.out.print("0"); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator