/*-----------------------------------------------------------------------
【程序设计】
-------------------------------------------------------------------------
题目:猴子第一天摘下若干个桃子,当即吃了一半,还不过瘾,又多吃了一个。第
二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩
下的一半零一个。直到最后一天早上想再吃时,见只剩下一个桃子了。通过输入来
控制吃桃的最后一天,编写函数求第一天共摘了多少桃子。
输入输出如下所示:
【输入猴子还剩1 个桃子的最后一天: 】10
猴子第一天摘了1534 个桃子
-------------------------------------------------------------------------
注意:请勿改动程序中的其他内容,请勿重新定义变量名。
------------------------------------------------------------------------*/
#include <stdio.h>
int countPeaches(int lastDay)
{
    int peaches = 1;
    int day;
    /**********Program**********/
   day = lastDay;
   while(day>1){
	peaches = (peaches+1)*2;
	day--;
   } 
   return peaches;
    /********** End **********/
}
int main()
{
    int lastDay;
    int totalPeaches;
    printf("【输入猴子还剩1 个桃子的最后一天:】 ");
    scanf("%d", &lastDay);
    totalPeaches = countPeaches(lastDay);
    printf("猴子第一天摘了%d 个桃子\n", totalPeaches);
    return 0;
}