Hang Dian 2178 (combining the idea of dichotomy)

1. The largest guessed number: m=2 to the nth power -1.
2. If you use the pow function, you need to force type conversion.

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    
    
    int n,i;
    scanf("%d",&n);
    while(n--)
    {
    
    
        scanf("%d",&i);
        printf("%d\n",(int)(pow(2,i)-1));
    }
    return 0;
}

Guess you like

Origin blog.csdn.net/mingjiweixiao/article/details/113525225