/*
ID:15521201
LANG:C++
PROG:dualpal
*/
#include <iostream>
#include <cstdio>
char t[10000];
const char jinzhi[]={'0','1','2','3','4','5','6','7','8','9'};
using namespace std;
int main()
{
freopen("dualpal.in","r",stdin);
freopen("dualpal.out","w",stdout);
int change(int n,int a);
int judge(int n);
int n,s,num,i,single;
cin>>n>>s;
for(i=s+1,num=0;num<n;i++)
{
single=0;
for(int j=2;j<=10;j++)
{
if(change(j,i)==1)
single++;
if(single==2)
{
cout<<i<<endl;
num++;
break;
}
}
}
return 0;
}
int judge(int n)
{
int a=1;
for(int i=0;i<n/2;i++)
if(*(t+i)!=*(t+n-1-i))
{
a=0;
break;
}
return (a);
}
int change(int n,int a)
{
int i,b;
for(i=0;a!=0;a=a/n)
{
t[i]=jinzhi[a%n];
i++;
}
t[i]='\0';
b=judge(i);
return(b);
}
这题也没什么好说的 就是列举从s+1开始到出现第n个满足条件的数为止(从第1个到第n个)(满足进制2到10中有至少两个回龙数)
ID:15521201
LANG:C++
PROG:dualpal
*/
#include <iostream>
#include <cstdio>
char t[10000];
const char jinzhi[]={'0','1','2','3','4','5','6','7','8','9'};
using namespace std;
int main()
{
freopen("dualpal.in","r",stdin);
freopen("dualpal.out","w",stdout);
int change(int n,int a);
int judge(int n);
int n,s,num,i,single;
cin>>n>>s;
for(i=s+1,num=0;num<n;i++)
{
single=0;
for(int j=2;j<=10;j++)
{
if(change(j,i)==1)
single++;
if(single==2)
{
cout<<i<<endl;
num++;
break;
}
}
}
return 0;
}
int judge(int n)
{
int a=1;
for(int i=0;i<n/2;i++)
if(*(t+i)!=*(t+n-1-i))
{
a=0;
break;
}
return (a);
}
int change(int n,int a)
{
int i,b;
for(i=0;a!=0;a=a/n)
{
t[i]=jinzhi[a%n];
i++;
}
t[i]='\0';
b=judge(i);
return(b);
}
这题也没什么好说的 就是列举从s+1开始到出现第n个满足条件的数为止(从第1个到第n个)(满足进制2到10中有至少两个回龙数)