| ||||||||||
| 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 | |||||||||
各位大牛们帮忙看哈是怎么WA的呢????#include<stdio.h>
#include<string.h>
int main()
{
int a[1010],max[1010];
int ans,n,i,j;
memset(a,0,sizeof(a));
memset(max,0,sizeof(max));
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
max[1]=1;
for(i=2;i<=n;i++)
for(j=1;j<i;j++)
if(a[i]>a[j]&&max[j]+1>max[i])
max[i]=max[j]+1;
ans=-1;
for(i=1;i<=n;i++)
if(ans<max[i])
ans=max[i];
printf("%d\n",ans);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator