Skip to content

Instantly share code, notes, and snippets.

@fffaraz
Created March 12, 2015 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fffaraz/8d2d19f2783399571e63 to your computer and use it in GitHub Desktop.
Save fffaraz/8d2d19f2783399571e63 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
for(long long i=1000000000; i <= 9999999999; i++)
{
long long a = i;
int x[10] = {};
int y[10] = {};
for(int j=0; j<10; j++)
{
x[j] = a % 10;
y[x[j]]++;
a /= 10;
}
bool found = true;
for(int j=0; j<10; j++)
{
if(x[j] != y[9 - j])
{
found = false;
break;
}
}
if(found)
cout << ">>>> " << i << endl;
if(i % 10000000 == 0)
cout << i << endl;
}
cout << "END" << endl;
cin.get();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment