#include<stdio.h>
int b;
int p(int x){
int i,j,m,k,n,sum=0,a[100]={},t;
for(k=2;k<=10;++k)
{
n=x; t=0; m=1;
while(n) a[++t]=n%k, n/=k;
for(i=1,j=t;i<=j&&m;++i,--j)
if(a[i]!=a[j]) m=0;
if(m) ++sum;
if(sum>=2) return 1;
}
return 0 ;
}
int main(){
freopen("dualpal.in","r",stdin);
freopen("dualpal.out","w",stdout);
int i,n,m,sum=0;
scanf("%d %d",&n,&m);
for(i=m+1;sum<n;++i)
if(p(i)){
++sum;
printf("%d\n",i);
}
return 0;
}
USACO1.2:dualpal
最新推荐文章于 2018-12-19 18:07:35 发布