- public class 猴子吃桃 {
- static int total(int day){
- if(day == 10){
- return 1;
- }
- else{
- return (total(day+1)+1)*2;
- }
- }
- public static void main(String[] args)
- {
- System.out.println(total(1));
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/300520133680.html
来源: http://www.codesnippet.cn/detail/300520133680.html