# 1008 guessing numbers

Source: Internet
Author: User
Tags pow
A There are 1 numbers m,b to guess. b Every time you guess, a says &quot; too big &quot;,&quot; too small &quot; or &quot; right &quot;. <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;
}

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.