| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 572 人关注过本帖
标题:求cyclic number
只看楼主 加入收藏
心剑菩提
Rank: 1
等 级:新手上路
帖 子:249
专家分:0
注 册:2007-5-17
收藏
 问题点数:0 回复次数:8 
求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 
2007-10-24 20:11
绿梦
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2007-10-13
收藏
得分:0 

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

2007-10-24 20:23
绿梦
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2007-10-13
收藏
得分:0 
pass: 关键是循环的使用
2007-10-24 20:24
心剑菩提
Rank: 1
等 级:新手上路
帖 子:249
专家分:0
注 册:2007-5-17
收藏
得分:0 
是啊 我的移位实现不了啊 希望各位帮个忙啊

前世五百次的回眸 才换来今生的擦肩而过
2007-10-24 20:25
心剑菩提
Rank: 1
等 级:新手上路
帖 子:249
专家分:0
注 册:2007-5-17
收藏
得分:0 
关键在移位和高精度上

前世五百次的回眸 才换来今生的擦肩而过
2007-10-24 20:45
我不是郭靖
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:494
专家分:6
注 册:2006-10-4
收藏
得分:0 

2007-10-24 20:55
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
呵呵,我在论坛出过的题目
ZJU上的题目.

倚天照海花无数,流水高山心自知。
2007-10-24 21:06
心剑菩提
Rank: 1
等 级:新手上路
帖 子:249
专家分:0
注 册:2007-5-17
收藏
得分:0 
看不懂啊 能不能简单一点

前世五百次的回眸 才换来今生的擦肩而过
2007-10-25 07:59
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
不是吧,就是一个循环乘的过程,每次乘完记录每一位,看是否和初始时的位相同(用一数组a[10]去记录)

倚天照海花无数,流水高山心自知。
2007-10-25 08:12
快速回复:求cyclic number
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026911 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved