## OCC '19 S2 - Rimuru's Number Game

View as PDF

Points: 5
Time limit: 1.0s
Memory limit: 64M

Author:
Problem types

It's Pookmeister's birthday, and Rimuru wants to give him a gift. Knowing that he loves the numbers and , Rimuru wants to know how many different numbers less than or equal to that only consist of digits that are either or .

1. (20 points)
2. (80 points) No additional constraints.

#### Input Specification

A single integer .

#### Output Specification

The answer to the problem, on a single line.

#### Sample Input 1

13

#### Sample Output 1

2

#### Explanation for Sample 1

The only two numbers are and .

#### Sample Input 2

40

#### Sample Output 2

6

#### Explanation for Sample 2

The only valid numbers are , , , , and .

• commented on Feb. 11, 2020, 10:04 p.m.

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Sept. 26, 2020, 10:57 p.m.

You don't need to check every number. Consider the implications of the numbers only having the digits 2 and 3.