仿abc+cba=efg efg+gfe=xyz xyz+zyx=回文数

菲比寻常者 1年前 已收到1个回答 举报

候选人 幼苗

共回答了15个问题采纳率:100% 举报

100
101
110
111
130
131
150
160
180
200
210
230
写一段程序就可以解决这个问题了.
代码如下:
#include
#include
#include
using namespace std;
int trans( int x )
{
int cici = 0 ;
cici = cici * 10 + x % 10 ; x /= 10 ;
cici = cici * 10 + x % 10 ; x /= 10 ;
cici = cici * 10 + x % 10 ; x /= 10 ;
return cici ;
}
int main()
{
for ( int n = 100 ; n < 1000 ; n ++ )
{
int n1 = n + trans( n ) ;
int n2 = n1 + trans( n1 ) ;
int n3 = n2 + trans( n2 ) ;
if ( n3 == trans( n3 ) )
{
cout

1年前

3
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.013 s. - webmaster@yulucn.com