编程介的小学生 2019-04-21 13:59 采纳率: 20.5%
浏览 329

S个整数的从小到大的一种排列算法,怎么采用C语言的程序的设计的技术去实现它

Problem Description
On New Year Festival, Liu Qian’s magic impressed on little WisKey’s heart and he wants to learn some magic to make himself stronger.
One day, he met a cowman named LinLe. Linle is very nice, he told little WisKey the mysteries of magic. Now, little WisKey began to perform the magic to you.
“Hello, Everybody. I have five decimal numbers named a, b, c, d, e, (0 <= a, b, c, d, e <= 9) and I rearranged them, and then combined them into a number, for example = a*10000 + b*1000 + c*100 + d*10 + e*1. You know the number of permutations is 5! = 120. So you have 120 numbers in your hands, you can pick a number N from the 120 numbers and calculate the sum S of remain 119 numbers. AHA~, If you tell me the S, I can guess the N~!”
It’s easy? Okay, you can challenge this.

Input
Each line will contain an integer S. Process to end of file.

Output
For each case, output all possible N, print the number N with 5 digits, including the leading zeros, one line per case.
I promise every case have one solution at least. If have many N, please output them from small to large in one line, separate them with a blank space.

Sample Input
2933266
6392217
4245386

Sample Output
00038
07719
21238

  • 写回答

1条回答 默认 最新

  • 你的小余童鞋 2019-04-21 15:48
    关注

    可以尝试使用C语言的**冒泡排序**、**快速排序**方法
    很简单的,网上代码很多的

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮