Thursday, May 11, 2017

URI 1170 Solution in C, C++ | URI Blobs Solution

URI 1170 Solution in C, C++ | URI Blobs Solution


URI Online Judge Solution Blobs | Mathematics
URI Main Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1170

Problem Name: URI Problem 1170 Blobs
Problem Number : URI Problem 1170 Blobs Solution
Online Judge : URI Online Judge Solution
Level: Mathematics
Solution Language : C, C plus plus

URI 1170 Solution in C, C++ | URI Blobs Solution

URI Solution 1170 Blobs Code in C:

#include <stdio.h>

int main(){
    int n, dias, i;
    float x;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
            scanf("%f", &x);
            dias = 0;
            while(x > 1){
                    x /= 2;
                    dias++;
            }
            printf("%d dias\n", dias);
    }
    
    return 0;
}



URI Solution 1170 Blobs Code in C++:

#include <iostream>
using namespace std;

int main()
{
 int n, counter;
 float food;

 cin >> n;

 for (int i = 0; i < n; ++i)
 {
  cin >> food;
  counter = 0;

  while(food > 1)
  {
   counter++;
   food = food/2;
  }

  cout << counter << " dias" << endl;
 }

 return 0;
}



Tags: Uri solve , Uri solution, URI oj Solve, URI Online Judge Solution list, URI 1170 code in C, URI 1170 code in C++, URI 1170 solution, URI BLob Soluton

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.