#MTH000000020. Hàm f91 (f91)
Hàm f91 (f91)
f91
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
McCarthy's recursive function is defined for positive integers by
$$f91(N)= \begin{cases} f91(f91(N+11)), & N\le100,\\ N-10, & N\ge101. \end{cases}$$Compute .
Input
One positive integer .
Output
Print exactly
f91(N) = value
where N is replaced by the input value and value is .
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): Full constraints: .
Examples
Input
500
Output
f91(500) = 490
Explanation
Here , and , so the second branch of the definition applies. Thus
Using the required output format, the program prints f91(500) = 490.