-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path36.cpp
More file actions
55 lines (52 loc) · 811 Bytes
/
Copy path36.cpp
File metadata and controls
55 lines (52 loc) · 811 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
using namespace std;
int isdoublep(int a,int b,int d)
{int *x=new int[100];
int c=0,f=a/(int)pow(10,d%2);
for(int i=1;i<=b;i++)
{c*=10;
f=a/(int)pow(10,d%2);
f=f/(int)pow(10,i-1);
c+=f%10;
}
a=a*(int)pow(10,b)+c;
cout<<a<<"\t"<<b<<"\t"<<d<<endl;
int i,j;
for( i=a,j=0;i>0;i/=2,j++)
{
x[j]=i%2;
if(a==585)
cout<<x[j];
}
for(int z=0;z<j&&z<j-z-1;z++)
if(x[z]!=x[j-z-1])
return 0;
return a;
}
int main()
{int ans=25;
int x=0;
for(int i=100;i<1000;i++)
{
if(x=isdoublep(i,3,6))
ans+=x;
}
for(int i=100;i<1000;i++)
{
if(x=isdoublep(i,2,5))
ans+=x;}
for(int i=10;i<100;i++)
{if(x=isdoublep(i,2,4))
ans+=x;}
for(int i=10;i<100;i++)
{if(x=isdoublep(i,1,3))
ans+=x;}
for(int i=1;i<10;i++)
{if(x=isdoublep(i,1,2))
ans+=x;}
cout<<ans;
return 0;
}