/*
ID:wconvey
PROG:dualpal
LANG:C++
*/
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int n,s,i,j,k,flag,temp,c,b,cnt;
int a[1000];
freopen("dualpal.in","r",stdin);
freopen("dualpal.out","w",stdout);
scanf("%d %d",&n,&s);
for(i=s+1;n!=0;i++)
{
//temp=i,flag=1;
cnt=0;
for(b=2;b<=10;b++)
{
k=0;
temp=i,flag=1;
while(temp!=0)
{
a[k++]=temp%b;
temp/=b;
}
for(j=0;j<=(k-1)/2;j++)
if(a[j]!=a[k-1-j])
{ flag=0;break;}
if(1==flag)
{
cnt++;
if(cnt>=2)
{
n--;
printf("%d\n",i);
break;
}
}
}
/* if(1==flag)
{
n--;
printf("%d\n",i);
}*/
}
return 0;
}
USACO 1.2.5 Dual Palindromes
最新推荐文章于 2024-06-22 23:23:22 发布