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 56 57 58 59 |
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <vector> #define ll long long #define LIMIT 9876543210 using namespace std; vector<int> vb; bool isRepeated(ll num) { if(num>=0 && num<=10) return 0; bool digits[10]; memset(digits,0,sizeof(digits)); while(num) { if(digits[num%10]) return 1; digits[num%10]=1; num/=10; } return 0; } int main() { int t; ll n; ll num; for(int i=1;i<1000005;i++) { if(isRepeated(i)==0) vb.push_back(i); } scanf("%d",&t); while(t--) { scanf("%lld",&n); for(int i=0;i<vb.size();i++) { num=vb[i]*n; if(num>LIMIT) { break; } if(isRepeated(num)==0) { printf("%lld / %d = %lld\n",num,vb[i],n); } } if(t) printf("\n"); } } |