def max_score(spots, days, scores, total_days):
dp = [[0] * (total_days + 1) for _ in range(len(spots) + 1)]
for i in range(1, len(spots) + 1):
for j in range(1, total_days + 1):
if days[i-1] <= j:
dp[i][j] = max(dp[i-1][j], dp[i-1][j-days[i-1]] + scores[i-1])
else:
dp[i][j] = dp[i-1][j]
return dp[len(spots)][total_days]
spots = ["故宫", "颐和园", "长城", "天坛"]
days = [1, 2, 3, 1]
scores = [7, 8, 9, 6]
total_days = 4
max_value = max_score(spots, days, scores, total_days)
print("在总时间为4天的情况下,能够获得的最大评分为:", max_value)