描述
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
输入
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.)
输出
For each input integer, write a line in the output indicating whether or not it is cyclic.
样例输入
142857
142856
142858
01
0588235294117647
样例输出
142857 is cyclic
142856 is not cyclic
142858 is not cyclic
01 is not cyclic
0588235294117647 is cyclic
参考代码
分享到:
相关推荐
c++程序设计- c++程序设计-全文共14页,当前为第1页。c++程序设计-全文共14页,当前为第1页。模拟考试题目一: c++程序设计-全文共14页,当前为第1页。 c++程序设计-全文共14页,当前为第1页。 1.定义长方体类cuboid...
C++小程序---打字练习游戏;简单的小游戏
Create visually appealing and feature-rich applications by using Qt 5 and the C++ language Qt 5, the latest version of Qt, enables you to develop applications with complex user interfaces for multiple...
Algorithms in C++, Parts 1-4: Fundamentals, Data Structures, Sorting, Searching(3rd Edition)英文版
Real-Time C++
谭浩强C++程序设计-习题程序.rar谭浩强C++程序设计-习题程序.rar谭浩强C++程序设计-习题程序.rar谭浩强C++程序设计-习题程序.rar
C++程序设计-原理-与-实践第2版—进阶篇
《Visual C++程序开发-范例宝典第2版》是2009年出版,《Visual C++程序开发-范例宝典》(即第1版)是2007年出版。以前同事有这本书,是第1版的,当时稍稍看了下,觉得挺震撼,实例几百个。最近要用到MFC、C++来做...
warning: gcc-c++-4.4.7-3.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY error: Failed dependencies: gcc = 4.4.7-3.el6 is needed by gcc-c++-4.4.7-3.el6.x86_64 libstdc++ = 4.4.7-...
C++ 中的平滑粒子流体动力学实现 运行代码 使用 make 编译并从 build 目录运行 ./ray 可执行文件 可选参数: -p: stiffness -s: surface tension -u: dynamic viscosity -r: particle radius -f: smoothing ...
《C++标准程序库:自修教程与参考手册》PDF 中文 The C++ Standard Library - A Tutorial and Reference CHM 英文原版
程序:MATLAB数字图像处理:从仿真到C C++代码自动生成
谭浩强C++程序设计-习题程序。C++程序设计课后练习的习题程序答案,谭浩强主编。
谭浩强C++程序设计-习题程序答案谭浩强C++程序设计-习题程序答案
C++ C++ C++ 整数 :fire: golang溢出 :fire: golang 2019-3-18 golang 2019-3-18 :fire: C++ 2019-4-16 C++ 2019-4-16 dp C++ 2019-5-7 C++ 2019-5-7 c++ hashtable 2019-5-15 c++二分查找2019-5-15 c++二分查找2019...
The appendices include a brief C++ language tutorial, information on the real-time C++ development environment and instructions for building GNU GCC cross-compilers and a microcontroller circuit. ...
C++程序设计与实践:11-模板和泛型编程.ppt