Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b084510

Browse files
Commit
1 parent 37ffbd7 commit b084510

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

‎Implimentation/Apple and Orange.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the countApplesAndOranges function below.
10+
def countApplesAndOranges(s, t, a, b, apples, oranges):
11+
ac=0
12+
oc=0
13+
dist=0
14+
for i in apples:
15+
dist=a+i
16+
if dist>=s and dist<=t:
17+
ac+=1
18+
for i in oranges:
19+
dist=b+i
20+
if dist>=s and dist<=t:
21+
oc+=1
22+
print(ac)
23+
print(oc)
24+
25+
26+
if __name__ == '__main__':
27+
st = input().split()
28+
29+
s = int(st[0])
30+
31+
t = int(st[1])
32+
33+
ab = input().split()
34+
35+
a = int(ab[0])
36+
37+
b = int(ab[1])
38+
39+
mn = input().split()
40+
41+
m = int(mn[0])
42+
43+
n = int(mn[1])
44+
45+
apples = list(map(int, input().rstrip().split()))
46+
47+
oranges = list(map(int, input().rstrip().split()))
48+
49+
countApplesAndOranges(s, t, a, b, apples, oranges)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /