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 tw7613781 at 2007-05-02 17:04:52 on Problem 1363
#include<iostream.h>
int function(int a[],int n)	
{
	int *b=new int[n];
	int i,temp,j,k,g;
	for(i=0;i<n;i++)
	{
		temp=a[i];
		for(j=i+1,k=0;j<n;j++)
			if(a[j]<temp) b[k++]=a[j];
		for(g=0;g<k;g++)
			if(b[g+1]>b[g]) return 0;
	}
	return 1;
}
void main()
{
	int n,i;
	cin>>n;
	while(n!=0)
	{
		int *a=new int[n];
		cin>>a[0];
		while(a[0]!=0)
		{
			for(i=1;i<n;i++)
				cin>>a[i];
			if(function(a,n)) cout<<"Yes"<<endl;
			else cout<<"No"<<endl;
			cin>>a[0];
		}
		cout<<endl;
		delete a;
		cin>>n;
	}
}

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