Recursive Function
Practice
3.4 (60 votes)
Easy
Problem
92% Success 30957 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Implement the recursive function given by the following rules and print the last 3 digits:
F(x, y) = {
y + 1 when x = 0,
F(x - 1, 1) when x > 0 and y = 0,
F(x - 1, F(x, y - 1)) when x > 0 and y > 0
}
Input Format
A single line containing two integers X,Y
1 <= X,Y <= 100000
Output Format
The last three digits
Input Constraints
X and Y are non-negative integers.
Problem Setter: Practo Tech Team
Submissions
Please login to view your submissions
Similar Problems
Points:30
4 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:30
57 votes
Tags:
Ad-HocEasyMathOpen
Points:30
22 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Editorial