当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6987:Cycle Binary

题目描述
We can rewrite a binary string (i.e. strings where only $0$ or $1$ is included) $s$ as $kp+p'$. $p'$ is a prefix of $p$ ($p'$ could be empty). $+p'$ means concatenating $p'$ to the last of $kp$. $kp$ means concatenating $k$ copies of $p$, where $p$ is the unit of $s$.

The unit of a binary string $s$ is when ignoring $p'$, the non-empty string $p$ which makes $k$ maximal.

We define $v(s)$ as the value of $s$, which is $k$ in the previous statement. For example, $v(01001001)=2$, because $01001001$ could be written as $2(010)+(01)$, and $v(11111)=5$ since $11111$ could be written as $5(1)$ and $p'$ is empty .

Now given $n$, your task is to calculate the sum of the value of all binary strings whose length is exactly $n$. As the answer could be very large, just output the answer modulo $998244353$.
输入解释
The first line contains a single positive integer $T\ (1\le T\le 100)$, indicating that there are $T$ test cases.

Each test case contains a single positive integer $n\ (1\le n \le 10^{9})$ in one line.

It is guaranteed that $\sum n\le 10^{10}$.
输出解释
For each test case, print an integer indicating the answer modulo $998244353$ in a single line.
输入样例
5
1
2
3
114
514
输出样例
2
6
12
954037435
530871613
来自杭电HDUOJ的附加信息
Hint For n=3,v(000)+v(001)+v(010)+v(011)+v(100)+v(101)+v(110)+v(111)=3+1+1+1+1+1+1+3=12

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6987

最后修改于 2021-10-23T19:10:55+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
16000/8000MS(Java/Others) 524288/524288K(Java/Others)