Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int putere2(long long x)
- {
- while(x%2==0)
- x/=2;
- if(x==1)
- return 1;
- return 0;
- }
- int main()
- {
- long long n,nr=0,aux;
- cin>>n;
- aux=n;
- if(putere2(n))
- {
- while(aux!=1)
- {
- aux/=2;
- nr++;
- }
- cout<<nr;
- }
- else cout<<-1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement