Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- int a[10];
- bool digit(ll a, ll b) {
- while(a!=0) {
- a/=10;
- b/=10;
- }
- if(a==0&&b!=0) return false;
- else return true;
- }
- bool digit2(ll x) {
- int a[10]={0};
- while(x>0) {
- a[x%10]++;
- x/=10;
- }
- for(int i=0;i<10;i++) {
- // cout << a[i] <<' ';
- if(a[i]>1) {
- return false;
- }
- }
- // cout << endl;
- return true;
- }
- int main() {
- ll t;
- cin >> t;
- while(t--){
- ll x;
- cin >> x;
- bool kkr=digit2(x);
- if(!kkr) {
- cout << endl;
- continue;
- }
- bool ans=true;
- if(!x) {
- cout << endl;
- continue;
- }
- for(int i=1;ans!=false;i++) {
- ans=digit(x,x*i);
- bool y=digit2(x*i);
- if(y==false) {
- continue;
- }
- if(ans==true) {
- cout << x*i << " / " << i << " = " << x << endl;
- }
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement