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 |
Re:SOS 高手请进In Reply To:SOS 高手请进 Posted by:AC_frantic at 2009-07-12 13:41:04 > #include<iostream> > #include<algorithm> > using namespace std; > int a[100001]; > int main() > { > int m=0,k=0,i=0; > int temp1=0,temp2=0,temp3=0; > while(cin>>m,m!=0) > { > int max=0,flag=0; > for(i=0;i<m;i++) > { > cin>>a[i]; > } > for(i=0;i<m;i++) > { > if(a[i]>0){flag++;max+=a[i];} > } > > if(flag==1||flag==0)//就是这里不懂 > { > sort(a,a+m); > printf("%d\n",a[m-1]+a[m-2]); > } > else > printf("%d\n",max); > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator