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 |
为什么我的程序会runtime error,而不是超时?哪位大虾帮我看看,不胜感激#include<iostream> using namespace std; int main() { int i,j,k,t,n,max; int num[10000],opt[10000]; cin>>t; for(k=0;k<t;k++) { cin>>n; max=1; for(j=1;j<=n;j++) cin>>num[i]; for(i=1;i<=n;i++) opt[i]=1; for(i=1;i<=n;i++) { for(j=1;j<i;j++) { if(num[i]>num[j] && opt[i]<opt[j]+1) opt[i]=opt[j]+1; } } for(i=2;i<=n;i++) if(max<opt[i]) max=opt[i]; cout<<max<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator