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 |
for(j=i+1;j<n;j++) if(a[j]<=sum) 这层循环没用啊,a是有序数列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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator