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 |
开个数组就行了 ----------------- 不多说贴代码 ACProblem: 2309 User: 351200 Memory: 252K Time: 16MS Language: C++ Result: Accepted Source Code #include<iostream> using namespace std ; int q[32] ; int main() { int N ,i; q[0]=1 ; for(i=1 ;i<31 ;i++) q[i]=q[i-1]*2 ; cin>>N ; while(N--) { int n ,t; cin>>n ; t=0 ; for(i=1 ;i<31 ;i++ ) { if(n%q[i]==0) { t++ ; } else { break ; } } cout<<n-q[t]+1<<" "<<n+q[t]-1 <<endl ; } return 0 ; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator