You are viewing a single comment's thread. Return to all comments →
Python solution is here:
import math import os import random import re import sys def countApplesAndOranges(s, t, a, b, apples, oranges): count_apple=0 count_orange=0 for i in apples: loc=a+i if loc<=t and loc>=s: count_apple+=1 print(count_apple) for i in oranges: loc2=b+i if loc2<=t and loc2>=s: count_orange+=1 print(count_orange) if __name__ == '__main__': first_multiple_input = input().rstrip().split() s = int(first_multiple_input[0]) t = int(first_multiple_input[1]) second_multiple_input = input().rstrip().split() a = int(second_multiple_input[0]) b = int(second_multiple_input[1]) third_multiple_input = input().rstrip().split() m = int(third_multiple_input[0]) n = int(third_multiple_input[1]) apples = list(map(int, input().rstrip().split())) oranges = list(map(int, input().rstrip().split())) countApplesAndOranges(s, t, a, b, apples, oranges)
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 →
Python solution is here: