{ "type": "code_options", "author": "csdn.net", "source": "solution.md", "exercise_id": "e87e276f38b048e8889e2fe7fe79b084", "keywords": "算法高阶,数论算法,算法问题选编,整数的因子分解", "title": "输出整数的全排列", "desc": [ { "content": "\n输入整数n(3<=n<=7),编写程序输出1,2,....,n整数的全排列,按字典序输出。\n输入样例:\n输入:3\n输出:123 132 213 231 312 321", "language": "markdown" } ], "answer": [ { "content": "", "language": "python" } ], "prepared": [ [ { "content": "", "language": "python" } ], [ { "content": "", "language": "python" } ], [ { "content": "", "language": "python" } ] ], "template": { "content": "import random\nn = int(input())\nt = list()\nt1 = set()\nfor i in range(1,n+1):\n\tt.append(str(i))\nwhile True:\n\tsum = 1\n\tfor i in range(1, n + 1):\n\t\tsum *= i\n\tif len(t1) >= sum:\n\t\tbreak\n\trandom.shuffle(t)\n\tt1.add(\"\".join(t))\ns = sorted(t1)\nfor i in s:\n\tprint(i,end=\" \")", "language": "python" }, "node_id": "dailycode-2bef970158ef4ce2bc686d63ee943610", "license": "csdn.net", "created_at": 1637894161, "topic_link": "https://bbs.csdn.net/topics/600470295" }