fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7.  
  8. while (t--) {
  9. int n;
  10. cin >> n;
  11.  
  12. vector<int> a(n);
  13. int beg = INT_MAX;
  14.  
  15. for (int i = 0; i < n; ++i) {
  16. cin >> a[i];
  17. beg = min(beg, a[i]);
  18. }
  19.  
  20. int ans = 0;
  21. for (int i = 0; i < n; ++i) {
  22. if (a[i] >= 2 * beg) {
  23. ans += ceil(static_cast<double>(a[i]) / (2 * beg - 1)) - 1;
  24. }
  25. }
  26.  
  27. cout << ans << "\n";
  28. }
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0.01s 5280KB
stdin
3
5
1 2 3 4 5
1
1033
5
600 900 1300 2000 2550
stdout
10
0
4