| ||||||||||
| 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 | |||||||||
你帮我看下这个程序出了什么问题In Reply To:Re:code...submit get WA,help me(using GCC) Posted by:ACMTino at 2005-08-31 13:05:53 #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