Palindrome Basis Solution | Codeforces Problem Solution 2022
You are given a positive integer . Let's call some positive integer without leading zeroes palindromic if it remains the same after reversing the order of its digits. Find the number of distinct ways to express as a sum of positive palindromic integers. Two ways are considered different if the frequency of at least one palindromic integer is different in them. For example, and are considered different but and are considered the same.
Formally, you need to find the number of distinct multisets of positive palindromic integers the sum of which is equal to .
Since the answer can be quite large, print it modulo .
The first line of input contains a single integer () denoting the number of testcases.
Each testcase contains a single line of input containing a single integer () — the required sum of palindromic integers.
No comments:
Post a Comment