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

超时也就算了,给我个RunTime Error的理由

Posted by ShenZhiBM at 2010-04-03 21:04:12 on Problem 2967
import java.util.*;
public class Main11
{
	public static void main(String[] args)
	{
		Scanner in=new Scanner(System.in);
		int a=in.nextInt();
		long[] arr=new long[a];
		for(int i=0;i<a;i++)
			arr[i]=in.nextLong();
		if(a<4)
			System.out.println("The set is rejected.");
		else
		{
			Arrays.sort(arr);
			if(arr[a-1]-arr[0]<arr[1])
				System.out.println("The set is rejected.");
			else{
				boolean bb=false;
				for(int i=a-1;i>=2;i--)
				{
					if(arr[i]-arr[i-2]<arr[i-1])
					{
						System.out.println("The set is accepted.");
						bb=true;
						break;
					}
				}
				if(!bb)System.out.println("The set is rejected.");
			}
		}
	}
}

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