Paperfolding

TimeLimit:1000MS  MemoryLimit:131072KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
There is a piece of paper in rectangular shape with sufficient length and width (lay flat on the table). Execute an operation instruction according to a string of length $n$ from left to right that only contains $4$ different characters of $L$,$R$,$U$,$D$.

1. $L$ instruction means to fold it from left to right,

2. $R$ instruction means to fold from right to left,

3. $U$ instruction means to fold from top to bottom,

4. $D$ instruction means to fold in half from bottom to top.

Note that the operation is limited due to the limitation of the desktop. Namely, the fold operation is restricted. For example, if you fold the paper from left to right, you should let the left side overlap on the right side with no rotation.

Now, cut a knife horizontally (completely cut) at the center of the visible part of the paper, and then cut vertically (completely cut).

The number of pieces of the whole paper split is $num(S)$.

See the example and the picture for better understanding.

Now given a nonnegative integer $n$, the string $S$ is generated from $4^n$ different possible outcomes in equal probability. Find the expected value of the number of pieces of the paper which is split, that is $E(num(S))$ mod $998244353$.

It can be shown that the answers can be represented by $\frac{P}{Q}$, where $P$ and $Q$ are coprime integers, and print the value of $P \times Q^{-1} \ mod $ $\space 998244353$.
Input
The first line contains a single integer $ T $ ($1 \le T \le 10^5$), the number of testcases.

Each of the next $ T $ lines contains a number $ n $ ( $0 \le n \le 10^{18} $ ).
Output
For each testcase, print the answer in one line.
SampleInput
2
0
1
SampleOutput
4
6
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: