SMAT Hits Hard!
Practice
0 (0 votes)
Easy
Problem
64% Success 329 Attempts 20 Points 0.5s Time Limit 256MB Memory 1024 KB Max Code

Mr SKW deeply wants his students to love SMAT in its entirety. He wants his students to enjoy every epsilon and delta that the course has to offer, however, he is strict and methodical. He hates students who write unbalanced parenthesis strings.

The definition of a balanced parenthesis string is :
1. If a string S is stable, then {S} is also stable.
2. If S and T are both stable, then ST (the concatenation of the two) is also stable.

All of these strings are balanced: {}, {}{}, and {{}{}}; But none of these: }{, {{}{, nor {}{.

Mr. SKW now asks you to find the number of balanced strings of length n. Complete this task to avoid a back and become the apple of his eyes :P

Input Format
The first and only line of input contains the integer n < 30.

Output Format
Print the number of balanced parenthesis strings of length n.

Problem Setter - Dhvit

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
19 votes
Tags:
Basic MathAlgorithmsMath
Points:20
17 votes
Tags:
MathematicsBasic MathModular arithmeticMath
Points:20
27 votes
Tags:
Brute-force searchMathematicsApprovedEasy