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

s[1010]={0}改成s[1010]={1},输出改一下应该就可以了

Posted by yiyiyi4321 at 2005-09-02 13:14:39 on Problem 2533
In Reply To:为什么总是WA呢?HELP! Posted by:novice at 2005-08-14 17:22:58
> #include<iostream.h>
> #include<stdio.h>
> int main()
> {
> 	int i,j,n,a[1010];
> 	double s[1010]={0},max;
> 	cin>>n;
> 	for(i=1;i<=n;i++)
> 		cin>>a[i];
> 	s[1]=1;max=0;
> 	for(i=2;i<=n;i++)
> 		for(j=1;j<i;j++)
> 			 if(s[j]+1>s[i]&&a[j]<a[i])
> 				s[i]=s[j]+1;
> 	for(i=1;i<=n;i++)
> 		cout<<s[i]<<" "; 
> 	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