No.1184 Hà Nội
レベル :
/ AI推定難易度 : 1300
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 234
作問者 :
kaage
/ テスター :
penguinman
タグ : / 解いたユーザー数 234
作問者 :
kaage
/ テスター :
penguinman
問題文最終更新日: 2020-08-22 14:06:18
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
技術室奥プログラミングコンテスト#5 Day1
(順位表)
の他の問題:
Problem Statement
Do you know the game called "Tower of Hanoi"? I do.
"Tower of Hanoi" is a game like the following.
$N$ 枚の、大きさの互いに異なる板が、上から大きさの昇順に塔に刺さっています。
今この板が刺さっている塔を塔 $A$ として、塔 $B$ にこの板をすべて移すことを考えます。
塔 $C$ を補助に使うことができますが、板は次の条件を満たすように移動させなければいけません。
- 小さい板の上にそれより大きい板を載せてはいけない。つまり、板の大きさがどの塔でも上から昇順になるように板を積まなくてはならない。
- それぞれの塔のいちばん上にある板しか動かせない。
- 板をまとめて複数枚動かすことはできない。
In this setting, how many operations are needed to move all the plates?
Find the minimum number of operations modulo $998244353$.
Input
$N\ L$
- $1\leq N,L\leq 10^{18}$
- All inputs are integers.
Output
Output the minimum number of operations needed modulo $998244353$ on 1 line.
Note that you must find the remainder of the minimum value, not the minimum value of the remainder.
Sample
Sample 1
Input
3 2
Output
3
You can perform the operations as follows.
- Move plate number $1$ to tower $C$.
- Move plates number $2,3$ together to tower $B$.
- Move plate number $1$ to tower $B$.
Sample 2
Input
1000000000000000000 1000000000000000000
Output
1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。