当前位置: 代码迷 >> C语言 >> 求cyclic number
  详细解决方案

求cyclic number

热度:1019   发布时间:2007-10-24 20:11:08.0
求cyclic number

(不会啊 各位高手 帮个忙 谢谢啊)
Description

A cyclic number is an integer n digits in length which, when multiplied by any integer from 1 to n, yields a"cycle"of the digits of the original number. That is, if you consider the number after the last digit to "wrap around"back to the first digit, the sequence of digits in both numbers will be the same, though they may start at different positions.For example, the number 142857 is cyclic, as illustrated by the following table:
142857 *1 = 142857
142857 *2 = 285714
142857 *3 = 428571
142857 *4 = 571428
142857 *5 = 714285
142857 *6 = 857142

Input

Write a program which will determine whether or not numbers are cyclic. The input file is a list of integers from 2 to 60 digits in length. (Note that preceding zeros should not be removed, they are considered part of the number and count in determining n. Thus, "01"is a two-digit number, distinct from "1" which is a one-digit number.)

Output

For each input integer, write a line in the output indicating whether or not it is cyclic.


Sample Input


142857
142856
142858
01
0588235294117647

Sample Output


142857 is cyclic
142856 is not cyclic
142858 is not cyclic
01 is not cyclic
0588235294117647 is cyclic

搜索更多相关的解决方案: number  cyclic  

----------------解决方案--------------------------------------------------------

虽然看起来有点麻烦但只有你认真分析应该能写出来,你不妨先自己写写试试啊


----------------解决方案--------------------------------------------------------
pass: 关键是循环的使用
----------------解决方案--------------------------------------------------------
是啊 我的移位实现不了啊 希望各位帮个忙啊
----------------解决方案--------------------------------------------------------
关键在移位和高精度上
----------------解决方案--------------------------------------------------------
老题了,自己去看

http://bbs.bc-cn.net/dispbbs.asp?boardid=5&replyid=392509&id=105515&page=1&skin=0&star=1
----------------解决方案--------------------------------------------------------
呵呵,我在论坛出过的题目
ZJU上的题目.
----------------解决方案--------------------------------------------------------
看不懂啊 能不能简单一点
----------------解决方案--------------------------------------------------------
不是吧,就是一个循环乘的过程,每次乘完记录每一位,看是否和初始时的位相同(用一数组a[10]去记录)
----------------解决方案--------------------------------------------------------
  相关解决方案