| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
各位大侠可不可以看一下哪里出了问题#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator