题目描述
#include <iostream>
using namespace std;
const int N = 100 + 1;
int cnt[N];
int main(){
int T; cin >> T;
while(T--){
int n,d; cin >> n >> d;
for(int i = 1; i <= n; i++) cin >> cnt[i];
int ans = cnt[1];
for(int i = 2; i <= n; i++){
int x = cnt[i];
while((i-1)*x > d) x--;
d-=(i-1)*x;
ans += x;
}
cout << ans << endl;
}
return 0;
}