Unlucky 7

AtCoder
IDabc186_c
Time2000ms
Memory256MB
Difficulty
Takahashi hates the number $7$. We are interested in integers without the digit $7$ in both decimal and octal. How many such integers are there between $1$ and $N$ (inclusive)? ## Constraints * $1 \leq N \leq 10^5$ * $N$ is an integer. ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
20
Output #1
17

Among the integers between $1$ and $20$, $7$ and $17$ contain the digit $7$ in decimal. Additionally, $7$ and $15$ contain the digit $7$ in octal.
Thus, the $17$ integers other than $7$, $15$, and $17$ meet the requirement.
Input #2
100000
Output #2
30555
API Response (JSON)
{
  "problem": {
    "name": "Unlucky 7",
    "description": {
      "content": "Takahashi hates the number $7$. We are interested in integers without the digit $7$ in both decimal and octal. How many such integers are there between $1$ and $N$ (inclusive)?",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc186_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Takahashi hates the number $7$.\nWe are interested in integers without the digit $7$ in both decimal and octal. How many such integers are there between $1$ and $N$ (inclusive)?\n\n## Constraints\n\n*   $1...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments