fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define fast_io ios::sync_with_stdio(false); cin.tie(NULL)
  5. #define int long long
  6.  
  7. void solve() {
  8. int n;
  9. vector <int> a;
  10. int sum=0;
  11. for(int i=1;i<=n;i++){
  12. cin>>a[i];
  13. if(a[i]<2*i) a[i]=2*i;
  14. sum+=a[i];
  15. }
  16. cout<<sum<<endl;
  17. }
  18.  
  19. int32_t main() {
  20. fast_io;
  21. int t;
  22. cin >> t;
  23. while (t--) solve();
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0.01s 5288KB
stdin
4
3
2 5 1
2
4 4
4
1 3 2 1
5
3 2 0 9 10
stdout
0
0
0
0