report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Unlucky number - MarisaOJ: Marisa Online Judge

Unlucky number

Time limit: 1000 ms
Memory limit: 256 MB
As we know, the number $13$ is considered an unlucky number. In East Asian culture, specifically in China and Japan, the number $4$ is also considered unlucky due to its pronunciation similarity to the word "death." A number is considered unlucky if its decimal representation contains the digit $4$ or $13$. For example, $132$ is unlucky, $40$ is unlucky, while $193$ is not. Count the number of positive integers that are unlucky and do not exceed $n$. ### Input - A single line containing an integer $n$. ### Output - Print the count of unlucky integers that satisfy the condition. ### Constraints - $1 \le n \le 10^{18}$. ### Example Input: ``` 1234 ``` Output: ``` 343 ```
Digit DP
Unlucky number
Digit Sum
Divisible
Prime digit sum
Non-palindrome number
Yet another XOR problem
Taboo substring
Balanced number
Equation
Beautiful number
Constructing numbers
Topic
Dynamic Programming
Rating 1300
Solution (0) Solution