Total passenger garlic garlic Jun eat peaches

Garlic Jun bought a bunch of peaches do not know the number, the first day of half-eaten peach, not good enough, there is to eat one. After he ate half the rest of the day more than a peach, to  nn  days only of a peach. Garlic king wanted to know how much to buy a start peaches.

Input Format

Enter an integer  n (2 \ le n \ le 60)n ( 2 n . 6 0 ) , represents the nn  only a peach.

Output Format

The number of buy peaches output.

Sample input 1

2

Sample output 1

4

Sample input 2

3

Sample output 2

10

#include <stdio.h>
#include <stdlib.h>
long long int tao(int n);
int main()
{
    int n ;
    scanf("%d",&n);
    printf("%.0lld",tao(n));


    return 0;
}
long long int  tao(int n)
{
    if(n==2)
    {
      return 4 ;
    }
    else
        return (tao(n-1)+1)*2;
}

Note that the range of the data type

Published 19 original articles · won praise 8 · views 4149

Guess you like

Origin blog.csdn.net/paohui001lqp/article/details/79458745