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 |
Re:不怎么好的题目In Reply To:不怎么好的题目 Posted by:houxuanfelix at 2006-07-25 20:37:32 #include <stdio.h> int main() { unsigned long X,Y,x1,x2,y=1; int l,i,j,n=0; unsigned long a[20]; scanf("%d",&l); for(i=0;i<l;i++) scanf("%d",&a[i]); for(i=0;i<l;i++) { if(a[i]!=0) { Y=a[i]; X=a[i]; while(X%2==0) { X=X/2; n++; } for(j=0;j<n;j++) y=y*2; y=y-1; x1=Y-y; x2=Y+y; if(x1>=1&&x2>=2) printf("%d %d\n",x1,x2); n=0; y=1; } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator