| ||||||||||
| 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 | |||||||||
code...submit get WA,help me(using GCC)#include <stdio.h>
long long pow( long long n ) ;
void process( long long n ) ;
int main()
{
int i , sum ;
long long n ;
scanf( "%d" , &sum ) ;
for( i=0 ; i<sum ; i++ )
{
scanf( "%lld" , &n ) ;
process( n ) ;
}
return 0 ;
}
long long pow( long long n )
{
long long s=1 ;
s <<= n ;
return s ;
}
void process( long long n )
{
int i=0 ;
long long no_use = n ;
if( no_use&1 ) printf( "%lld\n" , n ) ;
else
{
while( 1 )
{
if( no_use&1 ) break;
no_use >>= 1 ;
i++ ;
}
printf( "%lld %lld\n" , 1+n-pow(i) , n+pow(i)-1 );
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator