Skip to content

Instantly share code, notes, and snippets.

@KhaledElshamy
Created March 3, 2017 11:48
Show Gist options
  • Save KhaledElshamy/fda842572916d892a28619d937b31dfc to your computer and use it in GitHub Desktop.
Save KhaledElshamy/fda842572916d892a28619d937b31dfc to your computer and use it in GitHub Desktop.
725-UVA Solution
// working.cpp by Bill Weinman <http://bw.org/>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int abcde,fghij,n;
while(cin>>n)
{
for(fghij=1234;fghij<98765/n;fghij++)
{
abcde=fghij*n;
int limit, use=(fghij<10000);
limit=abcde;
while(limit){use|=(1<<(limit%10));limit/=10;};
limit=fghij;
while(limit){use|=(1<<(limit%10));limit/=10;};
if(use==(1<<10)-1)
printf("%0.5d / %0.5d = %d\n", abcde, fghij, n);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment