UVa 10696

From Algorithmist
Jump to: navigation, search

10696 - f91[edit]

Summary[edit]

This problem is funny. There are no tricks, and there are quite a few ways to "solve" this, and it's easy to code.

Explanation[edit]

No explanations needed, simply follow the calculation, doing it recursively, figuring out a pattern, it doesn't get much easier than this! There is a shortcut way to solve this problem.That is if(n<=100) printf("f91(%d) = %d\n",n,91); if(n>=101) printf("f91(%d) = %d\n",n,n-10); --MD. JULKER NEYEN SAMPAD 02:29, 19 July 2014 (EDT)

Gotcha's[edit]

  • 0 is not part of the test set.

Implementations[edit]

Input[edit]

500
91
0

Output[edit]

f91(500) = 490
f91(91) = 91