atcoder#ABC222H. [ABC222H] Beautiful Binary Tree
[ABC222H] Beautiful Binary Tree
Score : points
Problem Statement
For a positive integer , a rooted binary tree that satisfies the following conditions is said to be a beautiful binary tree of degree N.
- Each vertex has or written on it.
- Each vertex that is a leaf has written on it.
- It is possible to do the following operation at most times so that the root has written on it and the other vertices have written on them.- Choose vertices and , where must be a child of or a child of "a child of ." Let , where and are the numbers written on and , respectively.
Given , find the number, modulo , of beautiful binary trees of degree .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
1
1
The only binary tree that satisfies the condition is a tree with one vertex whose root has written on it.
2
6
The binary trees that satisfy the condition are the six trees shown below.
222
987355927
222222
675337738