-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdualpal.cpp
More file actions
40 lines (40 loc) · 801 Bytes
/
dualpal.cpp
File metadata and controls
40 lines (40 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
ID:Peter Shi
TASK:dualpal
LANG:C++
*/
#include<bits/stdc++.h>
using namespace std;
bool check(int n){
int sum=0;
for(int i = 2;i<=10;i++){
int ans[25],k=1,num=n;
bool flag=true;
for(int j = 1;num!=0;j++){
ans[j]=num%i;
num/=i;
k=j;
}
for(int l=1,r=k;l<=r;l++,r--){
if(ans[l]!=ans[r]) flag=0;
}
if(flag) sum++;
}
if(sum>=2) return true;
return false;
}
int main(){
freopen("dualpal.in","r",stdin);
freopen("dualpal.out","w",stdout);
int n,s,i=0,i1=1;
cin>>n>>s;
while(i<n){
int num=s+i1;
if(check(num)){
cout<<num<<endl;
i++;
}
i1++;
}
return 0;
}