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

for(j=i+1;j<n;j++) if(a[j]<=sum) 这层循环没用啊,a是有序数列

Posted by ning at 2005-12-29 07:49:26 on Problem 2640
In Reply To:Re:请牛人指点一下!!!好像不是仅仅能否构成空间三角形!! Posted by:libanghui at 2005-10-10 22:50:07
> qsort下~很简单,想明白了就偷偷笑
> 
> qsort(a,n,sizeof(double),compar);
> 
> sum=0;flag=0;
> for(i=0;i<n-1;i++)
> {
> 	sum+=a[i];
> 		
> 	for(j=i+1;j<n;j++)
> 	if(a[j]<=sum)
> 	{	
>          flag=1; goto out;
> 			
> 
> 	}
> }
> 
> 	out:
> 	if(flag)
> 		cout<<"YES"<<endl;
> 	else
> 		cout<<"NO"<<endl;
> 

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