这个题不是看得太懂,用Python写的代码,不知道哪里出问题了。输入样例:You are a three eight pig .,我得到的结果是1964,而标准答案是10964.不知道为甚么是10.1的平方不是1吗?
s1 = "one two three four five six seven eight nine ten eleven twelve"
s2 = " thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty"
s3 = " a both another first second third"
s =s1 + s2 + s3
lst = s.split()
nums = [i for i in range(1,21)]
n = [1,2,1,1,2,3]
nums.extend(n)
dct = {}
for key,val in zip(lst,nums):
dct[key] = val
mima = []
str1 = input().split()
for word in str1:
if word in dct.keys():
a = dct[word] ** 2 % 100
if a != 0:
mima.append(a)
if len(mima):
mima.sort()
mima = [str(i) for i in mima]
print(''.join(mima))
else:
print(0)