読者です 読者をやめる 読者になる 読者になる

SRM403 Div1Easy TheLuckyNumbers

class TheLuckyNumbers {
private:
  
  int solve(long long n, int a, int b) {
    if(n > b) return 0;
    return solve(10*n+4, a, b) + solve(10*n+7, a, b) + (a<=n&&n<=b);
  }

public:
  int count(int a, int b) {
    return solve(0, a, b);
  }
};