Can anyone tell me why this code snippet is raising time limit issue?
using namespace std;
int main()
{
int t,p,n=2048,res=0;
std::cin >> t;
while(t–)
{
std::cin >> p;
 while(p!=0)
 {
 if(p>=n)

{

p=n;

n/=2;

res+=1;

}

else

{

n/=2;

}

}
 std::cout << res << ‘\n’;
 }
 return 0;