骄傲的赛亚人

1,2,3,4 这 4 个数字,能组成多少个互不相同的且无重复的三位数,都是多少?

点击查看代码
i = 0
for x in range(1,5):
    for y in range(1,5):
        for z in range(1,5):
            if (x!=y) and (x!=z) and (y!=z):
                i+=1
                if i %4:
                    print("{}{}{}".format(x,y,z),end=" | ")
                else:
                    print('{}{}{}'.format(x,y,z))
###### 输出: 123 | 124 | 132 | 134 142 | 143 | 213 | 214 231 | 234 | 241 | 243 312 | 314 | 321 | 324 341 | 342 | 412 | 413 421 | 423 | 431 | 432

posted on 2022-03-04 22:12  骄傲的赛亚人  阅读(58)  评论(0编辑  收藏  举报

导航