-
Notifications
You must be signed in to change notification settings - Fork 0
/
Apple and Orange
58 lines (41 loc) · 1.02 KB
/
Apple and Orange
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the countApplesAndOranges function below.
def countApplesAndOranges(s, t, a, b, apples, oranges):
hit1=[]
hit2=[]
c1=0
c2=0
for i in range(0,m):
res1= apples[i] + a
hit1.append(res1)
#print(hit1)
for j in range(0,n):
res2= oranges[j] + b
hit2.append(res2)
#print(hit2)
for k in range (0,len(hit1)):
if hit1[k] in range(s,t+1):
c1=c1+1
for l in range (0,len(hit2)):
if hit2[l] in range(s,t+1):
c2=c2+1
print(c1)
print(c2)
if __name__ == '__main__':
st = input().split()
s = int(st[0])
t = int(st[1])
ab = input().split()
a = int(ab[0])
b = int(ab[1])
mn = input().split()
m = int(mn[0])
n = int(mn[1])
apples = list(map(int, input().rstrip().split()))
oranges = list(map(int, input().rstrip().split()))
countApplesAndOranges(s, t, a, b, apples, oranges)