文件名称:mm
介绍说明--下载内容均来自于网络,请自行研究使用
若一个数(首位不为零)从左向右读与从右向左读都一样,我们就将其称之为回文数。
例如:给定一个10进制数56,将56加65(即把56从右向左读),得到121是一个回文数。
又如:对于10进制数87:
STEP1:87+78 = 165
STEP2:165+561 = 726
STEP3:726+627 = 1353
STEP4:1353+3531 = 4884
在这里的一步是指进行了一次N进制的加法,上例最少用了4步得到回文数4884。
写一个程序,给定一个N(2<=N<=10或N=16)进制数M,求最少经过几步可以得到回文数。
(十六进制数使用大写ABCDEF)
输入
N M
M的位数小于10-If a number (the first non-zero) reading from left to right and from right to left the same time, we will call it a palindrome. For example: Given a decimal number 10, 56, will be 56 plus 65 (that is, to 56 read from right to left), received 121 is a palindrome. Another example: For the 10 number 87: STEP1: 87+78 = 165 STEP2: 165+561 = 726 STEP3: 726+627 = 1353 STEP4: 1353+3531 = 4884 step here is the band conducted a N in addition, the patients received at least step 4 with the palindrome 4884. Write a program that, given a N (2 < = N < = 10 or N = 16) hexadecimal number M, seeking at least after a few steps can be palindrome. (Hexadecimal number using uppercase ABCDEF) Enter the number of bits is less than 10 NM M output
(系统自动生成,下载前可以参看下载内容)
下载文件列表
mm.txt