#P6103. [EER2] 直接自然溢出啥事没有
[EER2] 直接自然溢出啥事没有
Description
Given an integer , ask how many strings of length satisfy that the string is a “program fragment”.
The exact definitions are as follows:
A single semicolon ; is a “statement”.
The empty string is a “program fragment”.
If string A is a “program fragment” and string B is a “statement”, then AB is a “program fragment”.
If string A is a “program fragment”, then {A} is a “statement block”.
If string A is a “statement block”, then A is a “statement”, and []A and []()A are both “functions”.
If string A is a “function”, then (A) is a “function”, and A and A() are both “values”.
If string A is a “value”, then (A) is a “value”, and A; is a “statement”.
Note: A being B does not mean that B is A..
Input Format
One line containing one integer .
Output Format
One line containing one integer, representing the result of the answer modulo ().
4
9
7
140
Hint
Explanation for Sample 1
Valid “program fragments” include: ;;;;, ;;{}, ;{;}, ;{};, {;;}, {;};, {{}}, {};;, {}{}.
Note: This problem uses bundled tests. You will get the score for a subtask only after you pass all test points in that subtask.
Subtask 1 ( points): .
Subtask 2 ( points): .
Subtask 3 ( points): .
Subtask 4 ( points): no special constraints.
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号