|
||||||||||
Distinct Sub-palindromesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1441 Accepted Submission(s): 816 Problem Description S is a string of length n. S consists of lowercase English alphabets. Your task is to count the number of different S with the minimum number of distinct sub-palindromes. Sub-palindrome is a palindromic substring. Two sub-palindromes u and v are distinct if their lengths are different or for some i (0¡Üi¡Ülength), $u_i$¡Ù$v_i$. For example, string ¡°aaaa¡± contains only 4 distinct sub-palindromes which are ¡°a¡±, ¡°aa¡±, ¡°aaa¡± and ¡°aaaa¡±. Input The first line contains an integer T (1¡ÜT¡Ü$10^5$), denoting the number of test cases. The only line of each test case contains an integer n (1¡Ün¡Ü$10^9$). Output For each test case, output a single line containing the number of different strings with minimum number of distinct sub-palindromes. Since the answer can be huge, output it modulo 998244353. Sample Input
Sample Output
Source | ||||||||||
|