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 081300513 at 2010-03-23 12:34:11 on Problem 1067
#include<stdio.h>


int pick_figure_result(int m,int n)
{
	int m_count,n_count;
	if(m<0||n<0)return -1;

	else if(m==0||n==0)
	{
		return 1;
	}
	else
	{
		while(m!=0)
		{
			m_count+=m%2;
			m=m/2;
			
		}
		while(n!=0)
		{
			n_count+=n%2;
			n=n/2;
			
		}
		if((m_count+n_count)%2==0)
		{
			return 0;
		}
		else return 1;
	}
}
int main()
{
	int m,n;
	char c;
	int result[20];
	int i=0,j=0;
	int signal;
	printf("input any word and press enter to end the input operation!\n");
	signal = scanf("%d%d",&m,&n);
	 
	c = getchar();
    while(signal==2&&i<20)
	{
		result[i] = pick_figure_result(m,n);
		i++;
		
		signal = scanf("%d%d",&m,&n);
		c = getchar();
    }
	for(j=0;j<i;j++)
	{
		printf("\n%d",result[j]);
	}
	printf("\n");
	c = getchar();c = getchar();
	
	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