赞
踩
- #include <stdio.h>
-
- int main()
- { int f(int n);
- f(1);
- return 0;
- }
-
- int f(int n){
-
- int sub;
-
- if(n==7){
- sub=2;
- printf("经过第%d个村庄时还剩下%d只鸭子\n",n,sub);
- }else
- {sub=(f(n+1)+1)*2;
- printf("经过第%d个村庄时还剩下%d只鸭子\t卖了:%d只鸭子,\n",n,sub,(sub/2+1));}
- return sub;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。