which is time consuming construct in following program?
        Posted  
        
            by 
                user388338
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user388338
        
        
        
        Published on 2011-03-12T07:39:59Z
        Indexed on 
            2011/03/12
            8:10 UTC
        
        
        Read the original article
        Hit count: 231
        
while submitting a solution for practise problem 6(odd) i got TLE error
but while using using print and scanf in place cin and cout my sol was submitted successfully with 0.77s time..i want to know how can i make it more efficient
link to problem is codechef problem 6
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{int n,N;
 scanf("%d",&n);
 for(int l=0;l<n;l++) {
scanf("%d",&N); 
 int i=0,x; 
 if(N<=0)
continue; 
 for(;N>=(x=(2<<i));i++);
printf("%d",x/2); 
cout<<"\n";
 }
}
        © Stack Overflow or respective owner