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

Problem A.Alkane

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 149    Accepted Submission(s): 89


Problem Description
In organic chemistry, an alkane is an acyclic saturated hydrocarbon. In other words, an alkane consists of hydrogen and carbon atoms arranged in a tree structure in which all the carbon-carbon bonds are single. Alkanes have the general chemical formula CnH2n+2.
In an alkane, each carbon atom has 4 bonds (either C-C or C-H), and each hydrogen atom is joined to one of the carbon atoms (so in a C-H bond). The number of carbon
atoms may be thought of as the size of the alkane.
Alkanes with more than 3 carbon atoms can be arranged in various different ways, forming structural isomers. The simplest isomer of an alkane is the one in which the carbon atoms are arranged in a single chain with no branches. This isomer is sometimes called the n-isomer. However the chain of carbon atoms may also be branched at one or more points. The number of possible isomers increases rapidly with the number of carbon atoms.
Moreover, we define an alkyl is an alkane missing one hydrogen. An acyclic alkyl has the general formula CnH2n+1. The defination of structural isomer of alkyls is similar to alkanes¡¯.
Now you need to count the number of structural isomers of alkanes and alkyls of size n modulo 998244353.
 

Input
The first line of the input contains an integer T , denoting the number of test cases.
In each test case, there is a single integer n in one line, denoting the size of alkanes and alkyls.
1 ¡Ü T ¡Ü 100000, 1 ¡Ü n ¡Ü 100000
 

Output
For each test case, output one line contains two integers, denoting the number of structural isomers of alkanes and alkyls of size n modulo 998244353.
 

Sample Input
9 1 2 3 4 5 6 7 8 9
 

Sample Output
1 1 1 1 1 2 2 4 3 8 5 17 9 39 18 89 35 211
 

Hint


 

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-26 19:42:08, Gzip enabled