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 main(void) { int a,b,c,d; while(scanf("%d%d%d%d",&a,&b,&c,&d)==4) { int m=0,n=0; int a1=a,b1=b,c1=c,d1=d; while(c1>a1) { c1>>=1; m++; } while(d1>b1) { d1>>=1; n++; } int p=0,q=0; while(c>b) { c>>=1; p++; } while(d>a) { d>>=1; q++; } if(p+q<m+n) { printf("%d\n",p+q); } else { printf("%d\n",m+n); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator