标签:amp div sof pre nbsp 猴子吃桃 print href ota
http://acm.ocrosoft.com/problem.php?cid=1172&pid=12
10
total=1534
题解:
运用递归的思想,定义的A的函数代表的是第n天开始的时候所有的桃子,x的值从1开始到n结束。
代码:
#include <bits/stdc++.h>
using namespace std;
int n;
int A(int x)
{
if(x == n) return 1;
return 2*(A(x + 1) + 1);
}
int main()
{
while(cin>>n)
{
printf("total=%d\n",A(1));
}
return 0;
}
ocrosoft 程序设计提高期末复习问题M 递归求猴子吃桃
标签:amp div sof pre nbsp 猴子吃桃 print href ota
原文地址:https://www.cnblogs.com/zlrrrr/p/9195130.html