编程介的小学生 2019-02-04 10:55 采纳率: 20.5%
浏览 383

计算N的值,N以9开头满足 N=N%249+2,输出N作为结果,怎么使用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 本题的答案是不是有问题
    • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
    • ¥15 C++使用Gunplot
    • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
    • ¥15 matlab数字图像处理频率域滤波
    • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
    • ¥15 ELGamal和paillier计算效率谁快?
    • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
    • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
    • ¥15 Arcgis相交分析无法绘制一个或多个图形