Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么我的程序会runtime error,而不是超时?哪位大虾帮我看看,不胜感激

Posted by ymhd at 2009-04-01 19:40:15 on Problem 1631
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator