No.2216 Pa1indr0me
タグ : / 解いたユーザー数 186
作問者 :
stoq
/ テスター :
ekaraage
Problem Statement
Suppose you make a string $S$ of length $2N$ by arranging $N$ copies of '0' and $N$ copies of '1' in any order. What is the maximum possible number of non-empty contiguous substrings of $S$ that are palindromes?
Here, substrings are distinguished by the positions from which they are taken.
Answer $T$ test cases.
Input
$T$ $N_1$ $\vdots$ $N_T$
- All input values are integers.
- $1 \leq T \leq 100$
- $1 \leq N_i \leq 10^9$
Output
For each $i = 1,2,\dots,T$, output on the $i$-th line the answer to the problem for $N=N_i$.
Sample
Sample 1
Input
4 1 2 34 567891011
Output
2 6 1190 322500200942493132
In the $1$-st test case, for example, taking $S= \mathsf {01}$ gives $2$ palindromic contiguous substrings, and this is the maximum.
In the $2$-nd test case, for example, taking $S= \mathsf {0110}$ gives $6$ palindromic contiguous substrings, and this is the maximum.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。