• + 0 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;
    }