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

Card Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 525    Accepted Submission(s): 424


Problem Description
Recently, playing card games has become popular. SPY and Markyyz are also playing a game. In this game, the cards must be placed in piles. Any number of cards can be stacked in the same pile. Any card can be placed at the bottom of an empty pile. The stacked cards go from the bottom to the top, with decreasing and consecutive values. For example, piles $(5,4,3,2,1)$, $(8,7,6,5,4,3)$, $(9)$, and $()$ (an empty pile) are all valid, while piles $(4,2,1)$ (not consecutive), $(1,2,3)$ (not decreasing), and $(9,8,7,5,6,4,3,2)$ (neither consecutive nor decreasing) are not valid. (The description of the piles mentioned above is in the order from bottom to top).

In one move, a player can choose a card from the top of a non-empty pile and move it to the top of another pile. Throughout the player's moves, the stacking rules of the cards must be followed, otherwise it is considered a foul.

SPY is now playing the card game on a table with $n$ piles, where one pile contains $k$ cards $(k,k-1,k-2,...,2,1)$, called pile 1, and the rest of the piles are empty piles. All the free slots are empty. SPY wants to move all the cards from pile 1 to another pile (pile 2). At this point, clever Markyyz comes up with a question:

Given the number of piles $n$, under the condition of not fouling, what is the maximum value of $k$ that allows the movement of $k$ cards as described above?

Since the answer could be large, take the modulus of $998244353$.
 

Input
There are multiple test cases in this problem.

The first line of input contains a positive integer $t$ $(1\le t\le 10^5)$, indicating the number of test cases.

Afterwards, there are $t$ test cases. Each test case consists of a single line containing an integer $n$ $(2\le n\le 10^9)$, representing the number of piles.
 

Output
For each test case, output a single line containing an integer, representing the maximum value of $k$ for the number of cards. Take the modulus of $998244353$.
 

Sample Input
3 2 3 114514
 

Sample Output
1 3 766171354
 

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-11-22 21:18:49, Gzip enabled