What is wrong with this solution

Continuing the discussion from CHFHEIST - Editorial:

#include
#include
#include
#include
#define ll long long
using namespace std;

int main(){
int t;
cin>>t;
while(t–){
int D,d,p,q,s,rate,count=0,total=0;
cin>>D>>d>>p>>q;
int arr[D];
for(int i=0;i<D;i++){
arr[i]=p;
}
//for(int i=d;i<D;i++){
// arr[i]+=q;
//}
for(int i=1;i<=D;i++){
s=i*d;
if(s<=D){
for(int i=s;i<D;i++){
arr[i]+=q;
}
}
else{
count++;
}
}
for(int i=0;i<D;i++){
total+=arr[i];
}
cout<<total<<endl;

}
return 0;
}