aboutsummaryrefslogtreecommitdiff
path: root/challenge-243/eric-cheung/python/ch-2.py
blob: 8d186c9bf54cd17404eb63c14eccf16de5e8f05f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
from itertools import combinations

def GetFloorSum (arrInput):
    return int(arrInput[0] / arrInput[1]) + int(arrInput[1] / arrInput[0])

## arrNum = [2, 5, 9]  ## Example 1
arrNum = [7, 7, 7, 7, 7, 7, 7]  ## Example 2

arrCombList = combinations(arrNum, 2)
nSum = len(arrNum) + sum([GetFloorSum(arrLoop) for arrLoop in list(arrCombList)])

print (nSum)