Guess numbers (regular)

Source: Internet
Author: User

Welcome to the--bestcoder Anniversary (High quality topic + multiple Rewards)
Guess numbersTime limit:3000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 4041 Accepted Submission (s): 2887


Problem Descriptiona has 1 numbers m,b to guess. b Every time you guess, a says "too big", "too small" or "right."
Ask B to guess the maximum number of n times you can guess.
Input line 1th is an integer t, which indicates that there is a T-group of data, the following T-line
One integer per line n (1≤n≤30)
Output guess n times the maximum number that can be guessed
Sample Input2 1 3
Sample OUTPUT1 7
AUTHORZHOUSC Code:
1#include <stdio.h>2 intMain () {3     intn,t;4scanf"%d",&T);5      while(t--) scanf ("%d", &n), printf ("%d\n",(2<<n-1)-1);6     return 0;7}

Guess numbers (regular)

Contact Us

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.