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

ZOJ AC,POJ WA……

Posted by elephantmic at 2007-06-02 09:29:51 on Problem 1363
思路很简单 如果 a[i-1]>a[i+1] && a[i+1]>a[i] 则No,否则Yes
ZOJ过了,POJ错了。
请高手指点!

//POJ 1363
//ZOJ 1259
//Rails

#include<stdio.h>
#define N 1001

int main()
{
	int a[N];
	int i,j,k,n,flag;
	while(scanf("%d",&k) && k!=0)
	{		
		while(scanf("%d",&a[0]) && a[0]!=0)
		{
			flag=1;
			for(i=1;i<k;i++)
				scanf("%d",&a[i]);
			for(i=1;i<k-1;i++)
				if(a[i-1]>a[i+1] && a[i+1]>a[i])
				{
					printf("No\n");
					flag=0;
					break;
				}
			if(flag==1)printf("Yes\n");	
		}
		printf("\n");
	}
	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