Skip to content

Instantly share code, notes, and snippets.

@lostseaway
Created October 27, 2017 17:07
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 lostseaway/de8d8c980d8e9be8984aeda1cbcbe221 to your computer and use it in GitHub Desktop.
Save lostseaway/de8d8c980d8e9be8984aeda1cbcbe221 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
int main(){
unsigned long long set[3] = {0, 2, 7};
unsigned long long input;
unsigned long long ans;
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
scanf("%llu", &input);
for(a=0;a<3;a++){
for(b=0;b<3;b++){
for(c=0;c<3;c++){
for(d=0;d<3;d++){
for(e=0;e<3;e++){
for(f=0;f<3;f++){
for(g=0;g<3;g++){
for(h=0;h<3;h++){
for(i=0;i<3;i++){
for(j=0;j<3;j++){
for(k=0;k<3;k++){
for(l=0;l<3;l++){
for(m=0;m<3;m++){
for(n=0;n<3;n++){
for(o=0;o<3;o++){
for(p=0;p<3;p++){
for(q=0;q<3;q++){
ans = set[a]*10000000000000000ULL;
ans += set[b]*1000000000000000ULL;
ans += set[c]*100000000000000ULL;
ans += set[d]*10000000000000ULL;
ans += set[e]*1000000000000ULL;
ans += set[f]*100000000000ULL;
ans += set[g]*10000000000ULL;
ans += set[h]*1000000000ULL;
ans += set[i]*100000000ULL;
ans += set[j]*10000000ULL;
ans += set[k]*1000000ULL;
ans += set[l]*100000ULL;
ans += set[m]*10000ULL;
ans += set[n]*1000;
ans += set[o]*100;
ans += set[p]*10;
ans += set[q];
if(ans == 0)continue;
if(ans%input ==0){
printf("%llu\n",ans);
return 0;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment