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 |
consume party by c#include <iostream.h> const int hi=2000 ; ///////////////////// void main(){ float a[hi],tem,s; int n,sum=0,i,j ; cout<<"enter costume lenght(1 <S< 1,000,000) s = "; cin>>s; cout<<"\nenter number of cows(2<= N <= 20,000) N = ";cin>>n; for( i=0;i<n;i++) {cout<<"\ta["<<(i+1)<<"]="; cin>>a[i];} for( i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(a[i]>a[j]){ tem=a[i];a[i]=a[j];a[j]=tem;} for( i=0;i<n-1;i++) for( j=i+1;j<n;j++)if(a[i]+a[j]>s)j=n; else sum++; cout<<"\n= "<<sum<<" nuber of pairs cows."; cin>>n; } ////////////////////// Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator