-->
当前位置:首页 > 题库

PROGRAMMING:Group message 1

Luz5年前 (2021-05-10)题库426
As we all know, yooq is the God of graph theory and LC is the God of number theory.
Yooq is reading the news from XX group. Because there are too many news in the group, and the information is uneven, it makes yooq feel uncomfortable. However, yooq has a special permission in the group. Each operation can increase the length of any message by 1. But because yooq has no time to chat with Xuemei, he gives you this special permission. I hope you can help him change the length of these messages to the same with the least number of operations.
###Input format:
In the first line, enter the number of sample groups t (1 < = T < = 20). Each group of data input an n (1 < = n < = 100000), which means there are n messages. On the next line, enter n positive integers $$a_ 1,...,A_ n $$,$$A_ i(1<=i<=n,1<=A_ I < = 1000000) $$indicates the length of the i-th message.
###Output format:
Output the minimum number of operations to make all messages equal in length on one line.
###Input example:
```in
two
three
1 2 3
five
1 2 4 3 5
```
###Output example:
The corresponding output is given here. For example:
```out
three
ten
```







answer:If there is no answer, please comment