Memory Limit Exceeded(递归栈溢出)怎么解决
程序代码:
#include<stdio.h> int main() { int fun(int a,int b,int n); int a,b,n,N; while(scanf("%d%d%d",&a,&b,&n)!=EOF) { if(!(a==0&&b==0&&n==0)) { N=fun(a,b,n); printf("%d\n",N); } } return 0; } int fun(int a,int b,int n) { int N; if(n>2) { N=(a*fun(a,b,n-1)+b*fun(a,b,n-2))%7; return N; } else return 1; }
[此贴子已经被作者于2017-2-27 07:38编辑过]