SRM403div2题解
250:水题,就是给定一个n求一个不大于n的数且数字的每一位不是4就是7 ?暴力即可
?
#include <iostream>#include <cstring>#include <cstdio>using namespace std;#define LL long long//递归求解int solve(LL tmp, LL a, LL b) { if (tmp > b) return 0; return solve(tmp*10+4,a,b)+solve(tmp*10+7,a,b)+(tmp>=a&&tmp<=b);}class TheLuckyNumbers { public: int count(int a, int b) { if (a > b) swap(a, b); return solve(0, a, b); }};?
?
?