No.2748 Strange Clock
問題文最終更新日: 2024-04-19 23:34:07
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
CPCTF 2024 : PPC
(順位表)
の他の問題:
Problem Statement
Let $T3,T4,T6$ be the following timers.
- $T3$ : a timer that displays a base-$3$ number with $N$ digits
- $T4$ : a timer that displays a base-$4$ number with $N$ digits
- $T6$ : a timer that displays a base-$6$ number with $N$ digits
All of these timers follow the display rules below.
- At the start, at least $1$ of the displays of $T3,T4,T6$ was different.
- After the start, the number displayed by a timer increases by $1$ every $1$ second, and $1$ second after the maximum number that can be displayed with $N$ digits is shown, the display becomes $0$.
- After its display becomes $0$, the timer continues to repeat this behavior of increasing by $1$ every $1$ second.
$M$ seconds after the start, the displays of $T3,T4,T6$ all matched for the first time. How many displays at the start are possible?
Constraints
- $1 \le N \le 15$
- $1 \le M \le 10^{18}$
- All inputs are integers.
Input
The input is given from standard input in the following format.
$N$ $M$
Output
Output the answer.
Sample
Sample 1
Input
1 8
Output
1
When the displays at the start are $T3:1,T4:0,T6:4$, all displays match for the first time after $8$ seconds. No other displays satisfy the condition.
Sample 2
Input
8 247572573
Output
2025
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。