py 代码
N, V, M = tuple(map(int, raw_input().split()))
goods = [0]*N
for i in range(N):
tmp = raw_input()
goods[i] = tuple(map(int, tmp.split()))
dp = [[0 for j in range(M+1)]for i in range(V+1)]
for i in range(N):
for j in range(V, goods[i][0]-1, -1):
for k in range(M, goods[i][1]-1, -1):
dp[j][k] = max(dp[j][k], dp[j-goods[i][0]][k-goods[i][1]]+goods[i][2])
print dp[V][M]