8160 奇妙数

 

 

#include<bits/stdc++.h>
#define f(i,s,e) for(int i = s; i <= e; i++)
#define ll long long
using namespace std;
const int N = 1e3+10,inf = 0x3f3f3f3f;
int check(int n)
{
    int x = n;
    while(n != 0)
    {
        if(n % 10 != 0 && x % (n % 10) != 0) return 0;
        n /= 10;
    }
    return 1;
}
int main()
{
    int n,m,f = 0;
    cin >> n >> m;
    f(i,n,m)
        if(check(i))
            cout << i << " ",f++;
    if(!f)
        cout << -1;
    return 0;
}

 

posted @ 2024-06-28 14:49  CRt0729  阅读(35)  评论(0编辑  收藏  举报