https://www.hackerrank.com/challenges/apple-and-orange/problem
HackerRank - Apple and Orange
#!/bin/python3
import math
import os
import random
import re
import sys
def countApplesAndOranges(s, t, a, b, apples, oranges):
appleCount = 0
orangeCount = 0
fellPointApple = list(map(lambda apple: apple + a, apples))
fellPointOrange = list(map(lambda orange: orange + b, oranges))
for point in fellPointApple:
if(s <= point <= t):
appleCount += 1
for point in fellPointOrange:
if(s <= point <= t):
orangeCount += 1
print(appleCount)
print(orangeCount)
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)
'알고리즘 문제 풀기 > HackerRank' 카테고리의 다른 글
HackerRank - Between Two Sets (0) | 2019.01.20 |
---|---|
HackerRank - Kangaroo (0) | 2019.01.19 |
HackerRank - Grading Students (0) | 2019.01.17 |
HackerRank - Time Conversion (0) | 2019.01.16 |
HackerRank - Birthday Cake Candles (0) | 2019.01.15 |