Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Last active January 4, 2016 21:39
Show Gist options
  • Save KT-Yeh/8682476 to your computer and use it in GitHub Desktop.
Save KT-Yeh/8682476 to your computer and use it in GitHub Desktop.
#include <cstdio>
using namespace std;
int fn[101]={0};
int f91 (int N){
if (N > 100) return N-10;
if (fn[N] != 0) return fn[N];
fn[N] = f91(f91(N+11));
return fn[N];
}
int main()
{
int n;
while (scanf("%d",&n)){
if (!n) break;
printf("f91(%d) = %d\n",n,f91(n));
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment