Pat乙级1023题——组个最小数(Python)

代码测试结果为满分

def minNum():
    input = map(int, raw_input().split(' '))
    result = ''
    for i in range(1, len(input)):
        if input[i] == 0:
            continue
        else:
            for j in range(input[i]):
                result = result + str(i)
    if input[0] != 0:
        for i in range(input[0]):
            result = result[0] + str(0) + result[1:]
    print result

if __name__ == '__main__':
    minNum()

你可能感兴趣的:(python,PAT)