Thursday, October 4, 2018

Solution of URI 1170::Blobs

Before seeing the solution make sure that you have tried enough. Don’t copy the whole code, just find out the logic. If you feel any problemyou will inform me by comment.




#include <bits/stdc++.h>
using namespace std;

int main(){
    int N,dias;
    float X;

    cin>>N;

    while(N--){
        cin>>X;
        dias=0;

        while(X>1){
             X = X/2;
             dias++;
         }
        cout<<dias<<" dias"<<endl;
    }

    return 0;
}

No comments:

Post a Comment