Palindromic substrings
Time limit2sMemory limit512 MB
Count length-N uppercase strings whose length-M substrings include at least K palindromes.
- Level
Medium5 of 10
- Topics
- Brute force, String, Recursion, Bit manipulation
- Solved
- No attempts yet
Problem
Consider the strings of length made only of uppercase letters. Such a string has one substring of length for each starting position, in total. Write a program that counts the strings for which at least of those substrings are palindromes. Substrings with the same content but different starting positions are counted separately.
Input
The first line contains , , and , separated by spaces. (, )
Output
Print the number of strings that satisfy the condition on the first line. The answer is at most .
Hint
For , , the qualifying strings are AA, BB, CC through ZZ, the ones whose two letters match. For no palindrome is required, so every string of length qualifies.