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 |
这个C语言代码不可以 ?#include "stdio.h" #include "conio.h" #define maxsize 20 int Sumbin(int x) { int k,sum=0; while(x) { k=x%2; if(k==1) { sum++; } x=x/2; } return(sum); } main() { int data[maxsize],databin[maxsize]; int i=0,k=0,temp=1; while(temp) { scanf("%d",&temp); data[k]=temp; databin[k]=Sumbin(data[k]); k++; } for(i=0;i<k-1;i++) { do{ data[i]++; }while(databin[i]!= Sumbin(data[i])); printf("%d\n",data[i]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator