------
## 最终结论
```python
def largestNumber(cost, target):
    dp = [''] * (target + 1)
    dp[0] = ''
    
    for i in range(1, target + 1):
        for j in range(9):
            if i >= cost[j]:
                if dp[i - cost[j]] != '':
                    candidate = dp[i - cost[j]] + str(j + 1)
                    if len(candidate) > len(dp[i]) or (len(candidate) == len(dp[i]) and candidate > dp[i]):
                        dp[i] = candidate
    
    return dp[target] if dp[target] != '' else '0'

# Example usage:
cost = [4,3,2,5,6,7,2,5,5]
target = 9
print(largestNumber(cost, target))  # Output: "7772"
```