编程介的小学生 2019-05-24 00:53 采纳率: 20.5%
浏览 93

需要移动最大的步数的求解算法的问题,怎么采用C语言的程序设计的思维去实现呢?

Problem Description
As we all known, the Beijing Olympic Games had been hold in Aug 8th,2008.We are all excited about the opening ceremony directed by Yimou Chang. But how many people can taste the difficulties and the tears during the dress rehearsal.
I know we must have a deep impression to the performance named “Print”, finally it displays the Chinese word “和”, which means our Chinese people love peace and harmony. Yimou tells me that there are many actresses in the play, each one has a number from 1, 9, ... to 9^m(0<=m<2^31). Those whose number’s first digit is 9, will stand to make up the “和” at last, while others will squat. The total number of people who make up the “和” is N. Maybe N is too big, so let N=N%249+2.
Another moving story, there are N small circles on the ground. Each circle stands an actress. The N small circles form a big circle. At the beginning, the actresses play around the big circle clockwise. That means one actress jumped to the adjacent small circle in colckwise of the small circle she is now in. But clever Yimou find that after N times, every actress will be back to her original place. The time is too short. In order to lengthen the time of the performance, he changes his mind. Yimou also sets N arrows on the ground. Each small circle is just the start of a arrow and the end of another arrow. No circle has the same arrow’s start and end. Every actress jumps to the next circle along the direction of the arrow. When all the actresses return to their original circle, their performance ends. Now Yimou wants to know the maximal steps they can have. If you know the answer, please call “110” to tell Yimou, I think you will get a BIG surprise!

Input
There are multiple test cases. Each case only have an interger m. Process to the End Of File.

Output
For each case, output the final answer in one line.

Sample Input
1
23

Sample Output
3
4

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Jenkins+k8s部署slave节点offline
    • ¥15 微信小游戏反编译后,出现找不到分包的情况
    • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
    • ¥15 WPF使用Canvas绘制矢量图问题
    • ¥15 用三极管设计一个单管共射放大电路
    • ¥15 孟德尔随机化r语言运行问题
    • ¥15 pyinstaller编译的时候出现No module named 'imp'
    • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
    • ¥15 怎么把多于硬盘空间放到根目录下
    • ¥15 Matlab问题解答有两个问题