You are viewing a single comment's thread. Return to all comments →
void countApplesAndOranges(int s, int t, int a, int b, vector<int> apples, vector<int> oranges) { int appleCount = 0; int orangeCount = 0; for(int i = 0; i < apples.size(); i++) { apples[i] += a; if(apples[i] >= s && apples[i] <= t) { appleCount++; } } for(int i = 0; i < oranges.size(); i++) { oranges[i] += b; if(oranges[i] >= s && oranges[i] <= t) { orangeCount++; } } cout << appleCount << endl; cout << orangeCount << 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 →