Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Apple and Orange
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int startpoint, endpoint, applelock, orangelock, m, n, apples, apcnt = 0, oranges, orcnt = 0;
- cin >> startpoint >> endpoint >> applelock >> orangelock >> m >> n;
- for(int i = 0; i<m; i++)
- {
- cin >> apples; //apples felt
- if(applelock+apples >= startpoint && applelock+apples <= endpoint)
- {
- apcnt++;
- }
- }
- for(int i = 0; i<n; i++)
- {
- cin >> oranges; //oranges felt
- if(orangelock+oranges >= startpoint && orangelock+oranges <= endpoint)
- {
- orcnt++;
- }
- }
- cout << apcnt << endl << orcnt << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment