阿里 5.14笔试
第一题:零钱兑换(类似于爬楼梯)
n, x, y, z =list(map(int, input().strip().split()))
dp = [0] * (n + 1)
m0 = 100000000 + 7
dp[0] = 1
costs = [x, y, z]
for cost in costs:
for i in range(cost, n+1):
dp[i] = dp[i] + dp[i-cost]
print(dp[n])

第二题:
n, m = list(map(int, input().strip().split()))
h = list(map(int, input().strip().split()))
def sortup(li, b):
li1 = []
li1 = sorted(li[0:b])
li[0:b] = li1
return li
def sortdown(li, b):
li1 = []
li1 = sorted(li[0:b], reverse=True)
li[0:b] = li1
return li
while m:
a, b = list(map(int, input().strip().split()))
if a == 1:
h = sortup(h, b)
if a == -1:
h = sortdown(h, b)
m = m - 1
print(h)