A monkey off his first day of a number of peach, half eaten immediately, not fun, but also eat a; the next morning in turn eaten by the remaining peach half, then eat one. I eat every morning before the rest of the day after half a plus. When the N-morning want to eat, see only one peach. Q: The first day how many peaches were picked?
Input format:
input given positive integer N (1 <N≤10) in a row.
Output format:
output line number on the first day were picked peaches.
Sample input:
3
Output Sample:
10
solving ideas: the monkey had eaten a day is generally peaches in a eat, so we can launch (cycle n-1 sides, first incremented by 1, multiplied by 2 in), to n-1 Note !! all over the
reference code
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int sum=1;
for(int i=1;i<=n-1;i++){
sum++;
sum*=2;
}
printf("%d",sum);
}