UVa 10696 - f91

10696 - f91

 * http://acm.uva.es/p/v106/10696.html

Summary
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
No explanations needed, simply follow the calculation, doing it recursively, figuring ot a pattern, it doesn't get much easier than this!

Gotcha's

 * 0 is not part of the test set.

Code
Well i intially used maps to find out the pattern. After that it was trivial. /* temper3243@gmail.com */
 * 1) include

int calc(int n) {

if(n>=101) return n-10; else return 91; }

int main {		int n;	while(scanf("%d",&n)!=-1) {		if(n==0) break; printf("f91(%d) = %d\n",n,calc(n)); }	return 0; }

Input
500 91 0

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