-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path52.cpp
More file actions
40 lines (38 loc) · 694 Bytes
/
Copy path52.cpp
File metadata and controls
40 lines (38 loc) · 694 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
#include<iostream>
using namespace std;
void check(int i)
{
int* a=new int[10];
int *b=new int[10];
for(int j=i,k=2*i;j>0;j/=10,k/=10)
{a[j%10]++;b[k%10]++;}
for(int j=0;j<10;j++)
{if(a[j]!=b[j])return;}
b=new int[10];
for(int k=3*i;k>0;k/=10)
{b[k%10]++;}
for(int j=0;j<10;j++)
{if(a[j]!=b[j])return;}
b=new int[10];
for(int k=4*i;k>0;k/=10)
{b[k%10]++;}
for(int j=0;j<10;j++)
{if(a[j]!=b[j])return;}
b=new int[10];
for(int k=5*i;k>0;k/=10)
{b[k%10]++;}
for(int j=0;j<10;j++)
{if(a[j]!=b[j])return;}
b=new int[10];
for(int k=6*i;k>0;k/=10)
{b[k%10]++;}
for(int j=0;j<10;j++)
{if(a[j]!=b[j])return;}
cout<<i<<endl;
}
int main()
{
for(int i=100000;i<(1000000/6);i++)
check(i);
return 0;
}