2 条题解

  • 0
    @ 2023-12-17 15:39:49
    #include<bits/stdc++.h>
    using namespace std;
    int n,m,i,cnt,tot;
    string s,t;
    void turn(int n,int p){
    	if(n==0)return;
    	turn(n/p,p);
    	s+=n%p+48;
    }
    int main(){
    	cin>>n>>m;i=m;
    	while(++i){
    		cnt=0;
    		for(int j=2;j<=10;j++){
    			s="";
    			turn(i,j);
    			t=s;
    			reverse(s.begin(),s.end());
    			if(s==t)cnt++;
    		}
    		if(cnt>=2){
    			cout<<i<<endl;
    			tot++;
    			if(tot==n)return 0;
    		}
    	}
    	return 0;
    }
    
    

    信息

    ID
    228
    时间
    1000ms
    内存
    64MiB
    难度
    2
    标签
    递交数
    25
    已通过
    20
    上传者