#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define rep(i, a, n) for(int i = a; i <= n; i++)
#define per(i, a, n) for(int i = n; i >= a; i--)
typedef pair<int, int> PII;
const int N = 1e5 + 10;
int a[N];
void solve(){
//try it again.
int n; cin >> n;
rep(i, 1, n) cin >> a[i];
int ma = 0, sum = 0;
rep(i, 1, n) ma = max(ma, a[i]), sum += a[i];
int cnt = ma * (n - 1);
if(cnt < sum){
int c = sum / (n - 1);
if(sum % (n - 1)) c++;
cnt = c * (n - 1);
}
cout << cnt - sum << '\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
cin >> t;
while(t--)
solve();
}
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |
e-maze-in | Bricks Game |
Char Sum | Two Strings |
Anagrams | Prime Number |
Lexical Sorting Reloaded | 1514A - Perfectly Imperfect Array |
580A- Kefa and First Steps | 1472B- Fair Division |
996A - Hit the Lottery | MSNSADM1 Football |
MATCHES Playing with Matches | HRDSEQ Hard Sequence |
DRCHEF Doctor Chef | 559. Maximum Depth of N-ary Tree |
821. Shortest Distance to a Character | 1441. Build an Array With Stack Operations |