#include <bits/stdc++.h>
using namespace std;
#define int long long
int func(int n)
{
int res = 0;
while(n >= 10)
{
int a = n;
vector<int> num;
while(a)
{
num.push_back(a % 10);
a /= 10;
}
n = 1;
for(auto ni : num)
n *= ni;
++ res;
}
return res;
}
signed main()
{
int a, b;
cin >> a >> b;
int maxi = 0;
vector<int> ans;
for(int i = a; i <= b; ++ i)
{
if(func(i) > maxi)
{
ans.clear();
ans.push_back(i);
maxi = func(i);
}
else if(func(i) == maxi) ans.push_back(i);
}
cout << maxi << endl;
for(auto ai : ans)
cout << ai << (ai == ans.back() ? "" : " ");
return 0;
}
标签:20,int,res,L1,back,num,maxi,ans,103
From: https://www.cnblogs.com/Frodnx/p/18383249