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