35 lines
1009 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 『入门』(函数专题)验证回文数的猜测
[问题描述]
教学案例,必须使用函数完成求解!
  左右对称的自然数称回文数。如121422413731等有人猜测从任意一个两位或两位以上的自然数开始将该数与它的逆序数如1992的逆序数是2991相加得到一个新数再用这个新数与它的逆序数相加不断重复上述操作经过若干步的逆序相加之后总可以得到一个回文数例如从1992开始
1992+2991=4983
4983+3894=8877
8877+7788=16665
16665+56661=73326
73326+62337=135663
135663+366531=502194
502194+491205=993399。
  经过七步就得到了回文数。
  设计一个程序由计算机在局部范围内验证回文数的猜测并将寻找回文数的每一个步骤都显示出来。10步内不能得到则直接输出"NO"
[输入格式]
  一个整数( 小于 10^5 )。
[输出格式]
  10步内得到回文数则输出得到的步数否则输出“NO”。
[输入样例]
1992
[输出样例]
1992+2991=4983
4983+3894=8877
8877+7788=16665
16665+56661=73326
73326+62337=135663
135663+366531=502194
502194+491205=993399