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 5f9c948

Browse files
committed
update solutions
1 parent 99919a9 commit 5f9c948

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

‎implementation/apple-and-orange.py‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#https://www.hackerrank.com/challenges/apple-and-orange/problem
2+
3+
#!/bin/python3
4+
5+
import os
6+
import sys
7+
8+
#
9+
# Complete the countApplesAndOranges function below.
10+
#
11+
def countApplesAndOranges(s, t, a, b, apples, oranges):
12+
print(sum(s <= a + d <= t for d in apples))
13+
print(sum(s <= b + d <= t for d in oranges))
14+
15+
16+
if __name__ == '__main__':
17+
st = input().split()
18+
19+
s = int(st[0])
20+
21+
t = int(st[1])
22+
23+
ab = input().split()
24+
25+
a = int(ab[0])
26+
27+
b = int(ab[1])
28+
29+
mn = input().split()
30+
31+
m = int(mn[0])
32+
33+
n = int(mn[1])
34+
35+
apple = list(map(int, input().rstrip().split()))
36+
37+
orange = list(map(int, input().rstrip().split()))
38+
39+
countApplesAndOranges(s, t, a, b, apple, orange)

‎warmup/a-very-big-sum.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# https://www.hackerrank.com/challenges/a-very-big-sum/problem
2+
3+
#!/bin/python3
4+
5+
import os
6+
import sys
7+
8+
#
9+
# Complete the aVeryBigSum function below.
10+
#
11+
def aVeryBigSum(n, ar):
12+
sum = 0
13+
for i in range(n):
14+
sum = sum + ar[i]
15+
return sum
16+
17+
if __name__ == '__main__':
18+
f = open(os.environ['OUTPUT_PATH'], 'w')
19+
20+
n = int(input())
21+
22+
ar = list(map(int, input().rstrip().split()))
23+
24+
result = aVeryBigSum(n, ar)
25+
26+
f.write(str(result) + '\n')
27+
28+
f.close()

0 commit comments

Comments
(0)

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