A There are 1 numbers m,b to guess. b Every time you guess, a says " too big "," too small " or " right ". <br> Q B Guess the maximum number that can be guessed n times. <br>
Input line 1th is an integer t, which indicates that there is a T-group of data, below the T-line <br> an integer n (1≤n≤30) per line <br>
Output guess the maximum number of n times you can guess <br>
Sample Input
2<br>1<br>3
Sample Output
1<br>7<br>
Author ZHOUSC
Source ecjtu Summer Contest
Main topic:
Guess the number of games, that is, the number of T-line, each input one, if the big say hit, small said small, guess N times can guess the maximum number.
Problem Solving Ideas:
Guess n times, the maximum number that can be guessed is pow (2,n)-1. So from 1 to POW (2,n)-1, you can guess it in n times.
Feelings:
Substitution is not difficult, but also Chinese, only need to carefully understand test instructions, attention to detail.
#include <iostream>
#include <cmath>
using namespace Std;
int main ()
{
int n, t;
while (cin>>t&&t!=0)
{
for (int i = 0;i<t;i++)
{
CIN >> N;
cout << (int) (POW (2, N)-1);
}
}
return 0;
}