Help ramu problem 2

my code is always showing output as 0.
please let me know where my code is wrong.

#include
using namespace std;
int main() {
int t;
cin>>t;
for(int k=0;k<t;k++){
int c1,c2,c3,c4;
cin>>c1>>c2>>c3>>c4;
int n,m;
int r[100],c[100];
for(int i=0;i<n;i++){
cin>>r[i];
}
for(int i=0;i<m;i++){
cin>>c[i];
}
int rsum=0;
int csum=0;
int cost;
for(int i=0;i<n;i++){
cost=r[i]*c1;
rsum=rsum+min(cost,c2);
}
rsum=min(rsum,c3);
for(int i=0;i<m;i++){
cost=c[i]*c1;
csum=csum+min(cost,c2);
}
csum=min(csum,c3);
int tsum=rsum+csum;
tsum=min(tsum,c4);
cout<<tsum<<endl;
}
return 0;
}

Hi Gaurav, pls see that you haven’t took n and m as input. Due to this rsum and csum remains 0 and tsum = 0+0 and after that tsum = min(0,c4) i.e. 0. Just add

cin >> n >> m ;

it will work then. Also from next time save your code here and the share the link on this thread so that we can help you asap.

Hope this helps :slight_smile:

Hey Gaurav,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.