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 |
用这种方法可以吗???#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator