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

Re:这个是我的代码,你自己看看吧

Posted by huanghaoxiang at 2009-12-07 15:43:18 on Problem 1063
In Reply To:这个是我的代码,你自己看看吧 Posted by:dljlw at 2007-06-01 21:24:04
> #include<stdio.h>
> #include<math.h>
> /*
> 如果是奇数,那么一定是‘YES’
> 如果是偶数,则统计在奇数位上和偶数位上白棋的个数,如果他们相差小于2,那么也一定是'YES'
> */
> int main()
> {
> 	int n;
> 	scanf("%d",&n);
> 	while(n--)
> 	{
> 		int m,s[101],i;
> 		int ji=0,ou=0;
> 		scanf("%d",&m);
> 		if(m%2){for(i=1;i<=m;i++)scanf("%d",&s[i]);printf("YES\n");}
> 		else
> 		{
> 			for(i=1;i<=m;i++)
> 			{
> 				scanf("%d",&s[i]);
> 				if(!s[i] && i%2)ji++;
> 				if(!s[i] && !(i%2))ou++;
> 			}
> 		if(abs(ji-ou)<2)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