You are viewing a single comment's thread. Return to all comments →
Code in C++
void countApplesAndOranges(int s, int t, int a, int b, vector<int> apples, vector<int> oranges) { int c1=0,c2=0; vector<int>n1;vector<int>n2; for(int i=0;i<apples.size();i++){ n1.push_back(a+apples[i]); } for(int i=0;i<oranges.size();i++){ n2.push_back(b+oranges[i]); } for(int i=0;i<n1.size();i++){ if(n1[i]>=s && n1[i]<=t){ c1++; } } for(int i=0;i<n2.size();i++){ if(n2[i]>=s && n2[i]<=t){ c2++; } } cout<<c1<<endl; cout<<c2<<endl; }
Seems like cookies are disabled on this browser, please enable them to open this website
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
Code in C++