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

Yiwen with Formula

Time Limit: 32000/16000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 609    Accepted Submission(s): 232


Problem Description
Given an array $a$ of length $n$, for any array $b$ satisfying $1 \leq b_i \leq n$ and $b_1<b_2<\cdots<b_k$ ($k$ is the length of $b$, $k \geq 1$), calculate:

$$\prod_{b_1<b_2<\cdots<b_k} (a_{b_1}+a_{b_2}+\cdots+a_{b_k})$$

 

Input
The input consists of multiple test cases.

The first line contains an integer $T$ ($1 \leq T \leq 10$) -- the number of test cases.

For each test case:

The first line contains an integer $n$ ($1 \leq n \leq 10^5$), which is the length of $a$.

The second line contains $n$ integers $a_i$ ($0 \leq a_i \leq 10^5$), which is the array $a$.

It is guaranteed that:
- The sum of $n$ over all test cases will not exceed $2.5 \times 10^5$.
- The sum of $a_i$ in a single test will not exceed $10^5$.
- The sum of $a_i$ over all test cases will not exceed $4\times 10^5$.

 

Output
For each test case, output the result modulo $998244353$ in a single line.
 

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

Sample Output
2 144 417630946
 

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 21:08:46, Gzip enabled