| ||||||||||
| 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>
int a[1000],f[1000];
void dp(int n)
{
int i,j,max;
f[1]=a[0];max=1;
for(i=1;i<n;i++)
{
for(j=1;j<=n;j++)
{
if(a[i]<f[j]) { f[j]=a[j];break; }
else if(a[i]>f[max]) { f[++max]=a[i];break; }
}
}
printf("%d\n",max);
}
int main()
{
int i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=1;i<=n;i++)
f[i]=0;
dp(n);
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator