F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Cycle Binary

Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 148    Accepted Submission(s): 87


Problem Description
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$.
 

Input
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}$.
 

Output
For each test case, print an integer indicating the answer modulo $998244353$ in a single line.
 

Sample Input
5 1 2 3 114 514
 

Sample Output
2 6 12 954037435 530871613
 

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
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-25 22:53:56, Gzip enabled