UVA - 11986 Save from Radiation(二)

2015-07-20 17:56:18 · 作者: · 浏览: 18
n also be determined. So, there can be many options, but you need at least 2 rats.

题意:其实就是求n个普通液体和一瓶毒液,求最少需要几只老鼠同时实验,找出毒液

思路:其实就是能有几个2组成,不够的也要算

#include 
  
   
#include 
   
     #include 
    
      #include 
     
       using namespace std; int main() { int t; int cas = 1; long long n, ans; scanf("%d", &t); while (t--) { scanf("%lld", &n); ans = 0; while (n) { ans++; n /= 2; } printf("Case %d: ", cas++); printf("%lld\n", ans); } return 0; }