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

He is Flying

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2656    Accepted Submission(s): 730


Problem Description
JRY wants to drag racing along a long road. There are $n$ sections on the road, the $i$-th section has a non-negative integer length $s_i$. JRY will choose some continuous sections to race (at an unbelievable speed), so there are totally $\frac{n(n+1)}{2}$ different ways for him to ride. If JRY rides across from the $i$-th section to the $j$-th section, he would gain $j-i+1$ pleasure. Now JRY wants to know, if he tries all the ways whose length is $s$, what's the total pleasure he can get. Please be aware that in the problem, the length of one section could be zero, which means that the length is so trivial that we can regard it as $0$.
 

Input
The first line of the input is a single integer $T\ (T=5)$, indicating the number of testcases.

For each testcase, the first line contains one integer $n$. The second line contains $n$ non-negative integers, which mean the length of every section. If we denote the total length of all the sections as $s$, we can guarantee that $0 \le s \le 50000$ and $1 \le n \le 100000$.
 

Output
For each testcase, print $s+1$ lines. The single number in the $i$-th line indicates the total pleasure JRY can get if he races all the ways of length $i-1$.
 

Sample Input
2 3 1 2 3 4 0 1 2 3
 

Sample Output
0 1 1 3 0 2 3 1 3 1 6 0 2 7
 

Author
XJZX
 

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-23 19:27:08, Gzip enabled