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

用这种方法可以吗???

Posted by youngercool at 2007-05-26 01:48:39 on Problem 2291
#include "stdio.h"
void main ()
{
	int c, n, a[1000], i, j, k, max,  t;
	scanf ("%d", &c);
	for (i=0; i<c; i++)
	{
		scanf ("%d", &n);
		for (j=0; j<n; j++)
		{
			scanf ("%d", &a[j]);
		}
		n=j;
		max=0;
		for (j=0; j<n; j++)
		{
			t=a[j];
			for (k=0; k<n; k++)
			{
				if ((a[j]<a[k])&&(k!=j))
				{
					t=a[j]+t;
				}
			}
			if (t>max)
			{
				max=t;
			}
		}
		printf ("%d\n", max);
	}
}

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