UVa 11847 - Cut the Silver Bar Solution

#include <iostream>
#include <cmath>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    int n;
    while(cin>>n){
        if(!n)
            return 0;
        cout<<int(log2(n))<<endl;
    }
}

Comments