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

测试了各种数据都对,一个的情况也考虑了 为啥WA?

Posted by 987654OPK at 2010-08-06 22:12:36 on Problem 1887
#include<iostream>
using namespace std;
int main()
{
	int a[10001][2];
	int t,i,j,max;
	int no;
	no=1;
	a[0][0]=35000;
	a[0][1]=0;
	a[1][1]=1;
	cin>>a[1][0];
L:
	for(i=2;i<10001;i++)
	{
		cin>>a[i][0];
		if(a[i][0]==-1)
			break;
	}
	max=1;
	for(t=2;t<i;t++)
	{
		for(j=t-1;j>=0;j--)
			if(a[t][0]<=a[j][0]) break;
		a[t][1]=a[j][1]+1;
		if(a[t][1]>max) max=a[t][1];
	}
	cout<<"Test #"<<no<<endl<<"  "<<"maximum possible interceptions: "<<max<<endl<<endl;
	no++;
	cin>>a[1][0];
	if(a[1][0]!=-1) goto L;
	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