首页 > ACM题库 > HDU-杭电 > hdu 2274 Magic WisKey待解决[解题报告]C++
2014
01-04

hdu 2274 Magic WisKey待解决[解题报告]C++

Magic WisKey

问题描述 :

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, b, c, d, e> = 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.

输入:

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

输出:

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

样例输入:

2933266
6392217
4245386

样例输出:

00038
07719
21238


  1. Excellent Web-site! I required to ask if I might webpages and use a component of the net web website and use a number of factors for just about any faculty process. Please notify me through email regardless of whether that would be excellent. Many thanks

  2. 约瑟夫也用说这么长……很成熟的一个问题了,分治的方法解起来o(n)就可以了,有兴趣可以看看具体数学的第一章,关于约瑟夫问题推导出了一系列的结论,很漂亮