No.541 Number of Cycles on a 3 x N Grid
レベル :
/ AI推定難易度 : 2125
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 40
作問者 :
Ryuhei Mori
/ テスター :
はむこ
タグ : / 解いたユーザー数 40
作問者 :
はむこ
問題文最終更新日: 2026-06-25 11:37:27
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
yukicoder contest 168
(順位表)
の他の問題:
Problem Statement
An undirected graph whose vertices are connected in a lattice, with 4 vertices vertically and $N+1$ vertices horizontally,
is called a $3\times N$ grid. Find the number of simple cycles contained in the $3\times N$ grid, modulo
$10^9+7$.
Input
N
$1\le N \le 10^{18}$
Output
The number of simple cycles contained in the $3\times N$ grid, modulo $10^9+7$.
Sample
Sample 1
Input
1
Output
6
There are 3 cycles of size 1x1, 2 cycles of size 2x1, and 1 cycle of size 3x1, for a total of 6.
Sample 2
Input
20
Output
324214693
Sample 3
Input
100
Output
652583913
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。