/*
ID : cm750621
PROG : dualpal
LANG : C++
*/
#include <stdio.h>
const int MAX=10010;
int a[MAX];
int work(int n,int s){
int count=0;
while(s!=0){
a[count++]=s%n;
s/=n;
}
count--;
int i,j;
for(i=0,j=count;i<=count;i++,j--)
{
if(a[i]!=a[j])
return 0;
}
return 1;
}
int main(){
freopen("dualpal.in","r",stdin);
freopen("dualpal.out","w",stdout);
int i,j,count=0,tmp,n,s;
scanf("%d%d",&n,&s);
for(i=s+1;;i++){
tmp=i;
int count1=0,flag=0;
for(j=2;j<=10;j++){
count1+=work(j,tmp);
tmp=i;
}
if(count1>=2){
printf("%d\n",i);
count++;
}
if(count==n)
break;
}
return 0;
}
usaco 1.2.5 dualpal
最新推荐文章于 2022-07-09 22:59:01 发布