1229

来源:互联网 发布:c程序设计经典编程题 编辑:程序博客网 时间:2024/06/06 00:26
[提交][状态][讨论版]

题目描述

TY is a stupid guy. One day, he was asked to write all permutation of 1,2,3,4,5 on blackboard, but he was not managed to finish it. Can you help him?


Write a program output all the permutation of 1,2,3,4,5 in a ascend order.

输入

(no input)

输出

Print all the permutation of 1,2,3,4,5 in a an ascend order. 

One permutation per line.
12345
12354
...
54321

样例输入

样例输出

提示

来源

#include<stdio.h>int main(){    int i,j,k,l,m;for(i=1;i<=5;i++)for(j=1;j<=5;j++)for(k=1;k<=5;k++)for(l=1;l<=5;l++)for(m=1;m<=5;m++)if(i!=j&&i!=k&&i!=l&i!=m&&j!=k&&j!=l&&j!=m&&k!=l&&k!=m&&l!=m)printf("%d%d%d%d%d\n",i,j,k,l,m);}

0 0
原创粉丝点击