Problem 3054 --Rikka with Geometric Sequence

3054: Rikka with Geometric Sequence

"
Time Limit $7$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
A long time ago, Rikka was not good at math. Worrying about Rikka's grades, Yuta sets many interesting math problems for Rikka to help her improve her skills.

Now, as Rikka makes more and more progress on math, more and more she feels the joy of solving math tasks. Today, Yuta is quite busy and has no time to seek for new problems for Rikka. Therefore, for the first time, Rikka tries to come up with a problem herself.

Setting a problem is just like building blocks. The first step is to choose the bricks. Rikka selects the concepts of "geometric sequence" and "subsequence":

Sequence a1,…,ak is a geometric sequence if and only if for each index i∈[2,n−1], the values in the sequence holds a2i=ai−1×ai+1.

Sequnce b1,…,bt is a subsequence of a1,…,ak if and only if there exists an index sequence c1,…,ct(1≤ci≤k) which satisfies ci<ci+1 for each i∈[1,n)and aci=bi for each i∈[1,n].

The second step is to combine the bricks. It is quite simple for Rikka: she soon finds an interesting problem:

Given a positive integer n, count the number of different geometric subsequences of 1,2,…,n.

The last step, and also the most important step, is to solve the problem. However, this task seems to be too difficult for Rikka. Therefore she seeks for help from you: Could you please help her solve this interesting math problem?
The first line of the input contains a single integer T(1≤T≤1000).

For each test case, the input contains a single line with a single integer n(1≤n≤5×1017).

The input guarantees that there are no more than 3 test cases with n>109.
For each test case, output a single line with a single integer, the answer. The answer can be very large, you only need to print the answer modulo 998244353.
10
1
2
3
4
5
6
7
8
9
100
1
3
6
11
16
22
29
39
50
5187

推荐代码 查看3054 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 2019 Multi-University Training Contest 9 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛