Created
August 15, 2020 12:20
-
-
Save muthhukumar/c0b36eb30b8b1ce050d81259c0f950b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
inputs = list(map(int, input().split())) | |
from itertools import combinations | |
vowels = ['a', 'e', 'i', 'o', 'u'] | |
def getStringValue(num): | |
d = { 0 : 'zero', 1 : 'one', 2 : 'two', 3 : 'three', 4 : 'four', 5 : 'five', | |
6 : 'six', 7 : 'seven', 8 : 'eight', 9 : 'nine', 10 : 'ten', | |
11 : 'eleven', 12 : 'twelve', 13 : 'thirteen', 14 : 'fourteen', | |
15 : 'fifteen', 16 : 'sixteen', 17 : 'seventeen', 18 : 'eighteen', | |
19 : 'nineteen', 20 : 'twenty', | |
30 : 'thirty', 40 : 'forty', 50 : 'fifty', 60 : 'sixty', | |
70 : 'seventy', 80 : 'eighty', 90 : 'ninety' } | |
assert(0 <= num) | |
if (num < 20): | |
return d[num] | |
if (num < 100): | |
if num % 10 == 0: return d[num] | |
else: return d[num // 10 * 10] + '-' + d[num % 10] | |
if (num == 100): | |
return 'hundred' | |
count = 0 | |
for i in inputs: | |
value = getStringValue(i) | |
listValue = [k for k in value] | |
for e in listValue: | |
if e in vowels: | |
count += 1 | |
combination = sum([list(map(list, combinations(inputs, i))) for i in range(len(inputs) + 1)], []) | |
if count >= 100: | |
print("greater 100") | |
else: | |
total_count = 0 | |
for i in combination: | |
if sum(i) == count and len(i) == 2: | |
total_count += 1 | |
print(getStringValue(total_count)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment