回复 4楼 neverTheSame
帮我看看吧,谢谢啦
/*The problem of monkey eating peaches 10th is 1 peach left*/
/*第m天剩下n个*/
#include<stdio.h>
void main()
{
int n,i;
/*printf("the ? day left ? peaches");
scanf("%d,%d",&m,&n); */
int a(int n);
for(i=1;i<n;i++)
printf("the %d th day left %d peach(es).",i,a(i)) ;
getch();
}
int a(int n)
{
if(n==10)
return 1;
else
return (a(n-1)/2-1);
}