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

我没想法了~为什么错呢?

Posted by 570668687 at 2007-05-01 19:55:56 on Problem 1063
#include<iostream>
#include<math.h>
using namespace std;

int main()
{
	int t, res, i, m, n, a;
	bool flag;
	scanf("%d",&t);
	while(t--)
	{
		m = 0; n = 0;flag = false;
		scanf("%d",&res);
		if(res % 2 == 1)
		flag = true;
		else{	
			for(i = 0; i < res; i++)
			{
				scanf("%d",&a);
				if(a == 0&&i % 2 == 1)
				m++;
				if(a == 0&&i % 2 == 0)
				n++;
			}
			if(fabs(m-n) < 2)
			flag = true;
		}
		if(flag)
		printf("YES\n");
		else
		printf("NO\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