ACM--steps--4.1.8--猜数字

来源:互联网 发布:大数据可视化方法 编辑:程序博客网 时间:2024/06/03 23:42

猜数字

Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 319 Accepted Submission(s): 248 
Problem Description
A有1数m,B来猜.B每猜一次,A就说"太大","太小"或"对了" 。
问B猜n次可以猜到的最大数。
 
Input
第1行是整数T,表示有T组数据,下面有T行
每行一个整数n (1 ≤ n ≤ 30)
 
Output
猜n次可以猜到的最大数
 
Sample Input
213
 
Sample Output
17
 
Author
Zhousc
 
Source
ECJTU 2008 Summer Contest
 
Recommend
lcy


//原谅我愚钝的脑子。
#include<iostream>#include<cmath>using namespace std;int main(){    int T;    cin>>T;    while(T--)    {        int dyx;        cin>>dyx;        cout<<((int)pow(2,dyx)-1)<<endl;    }    return 0;}


0 0
原创粉丝点击