[恢]hdu 2178

2011-12-16 11:24:52

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2178

题意:中文。

mark:二分查找的应用。因为二分的最大次数是log2(n)。所以查询n次最大能查到的数是2^n-1。

代码:

# include <stdio.h>


int main ()
{
int n;
scanf ("%d", &n) ;
while (~scanf ("%d", &n))
printf ("%d\n", (1<<n) - 1) ;
return 0 ;
}



原文地址:https://www.cnblogs.com/lzsz1212/p/2314992.html