1008 猜数字

1008 猜数字

Problem Description
A有1数m,B来猜.B每猜一次,A就说"太大","太小"或"对了" 。
问B猜n次可以猜到的最大数。
 

Input
第1行是整数T,表示有T组数据,下面有T行
每行一个整数n (1 ≤ n ≤ 30)
 

Output
猜n次可以猜到的最大数
 

Sample Input

2
1
3
 

Sample Output

1
7
 



刚开始理解有错误,以为是给定两个数,然后在两个数之间求解猜的次数,后来发现理解正好相反了...


#include
#include
int main()
{
 int n,t;
 while(scanf("%d",&t)!=EOF)
 {
  while(t--&&scanf("%d",&n))
  {
   printf("%d\n",(int)pow(2,n)-1);
  }
 }
 return 0;
}

你可能感兴趣的:(1008 猜数字)