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

Re:SOS 高手请进

Posted by wowudao at 2009-07-16 16:02:55 on Problem 2593
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:
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