Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

各位大侠看下这个为什么会RE。。。。

Posted by 20114434 at 2012-07-30 08:40:22 on Problem 2128
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator