Petit computer 3 Community
MIKIifconfig
Open
Closed
Tournament
プログラム求む! (締め切りは特になし)
大会ってほど大げさではなくせいぜいfizzbuzz問題程度なのですが、もしよかったら挑戦してみてください。 1からn(nは2以上の整数)までの数字が書かれたカードがこの順で詰まれた山があり、この山に対して次の操作を繰り返して行います。 「一番上のカードを捨て、二番目のカードを山の一番下に移動する」 すなわち、第1回目の操作では1のカードが捨てられ、第1回目の操作後、山の状態は上から 3,4,5,6,..,n,2 となります。 それではここで問題です。 問題:上記のnと、i(iは1からn)を与えた時に、i回目の操作で捨てられるカード番号を返す def f(n,i) を書いてください。 完成したプログラムと「この問いを読んでから完成するまでに要した時間」を公開してください。 (回答についてはネタバレ推奨)
Advertisement
Add a Comment
Report Violation to Miiverse Administrators
You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.
Report Violation to Miiverse Administrators
You cannot report posts made automatically by a software title.

















