HDU 2178 猜数字

题解:设猜到的最大的数是h,在1到h间,你最多只要猜log2(h)+1(取整)次,
所以易知==>h=2^m-1.即猜m次,能猜到的最大的数为2^m-1。

#include <cstdio>
#include <cmath>
int main()
{
    int t;
    scanf("%d",&t);
    while (t--)
    {
        int n;
        scanf("%d",&n);
        printf ("%d
",(int )pow(2.0,n)-1);
    }
    return 0;
}
原文地址:https://www.cnblogs.com/forever97/p/3541214.html