首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

POJ2178:猜数目字

2013-03-19 
POJ2178:猜数字Problem DescriptionA有1数m,B来猜.B每猜一次,A就说太大,太小或对了 。 问B猜n次可以

POJ2178:猜数字
Problem DescriptionA有1数m,B来猜.B每猜一次,A就说"太大","太小"或"对了" 。 
问B猜n次可以猜到的最大数。 
 
Input第1行是整数T,表示有T组数据,下面有T行 
每行一个整数n (1 ≤ n ≤ 30) 
 
Output猜n次可以猜到的最大数
 
Sample Input

213
 
Sample Output
17
 


 

 

//公式

 

#include <iostream>#include <cmath>using namespace std;int main(){    int t,n;    while(cin >> t)    {        while(t--)        {            cin >> n;            cout << (int)pow(2,n)-1  << endl;        }    }    return 0;}


 

热点排行