题目 题意:定义一个数为Fari number,如果它能被它的每一位数的数字整除。给定数n,求不小于n的最小fair number。 思路:由于{1,2,3,…,9}的最小公倍数是2520,因此找ans是可以暴力找的。
#include
using namespace std;
#define ll long long
const ll mx = 1e18;
bool check(ll x) {
ll a = x;
int mp[10];
memset(mp, 0, sizeof(mp));
while (a) {
int num = a % 10;
a /= 10;
if (num) mp[num] = 1;
}
for (int i = 2; i
关注
打赏
热门博文