問題一覧 > 通常問題

No.906 Y-shaped Graph

レベル : / AI推定難易度 : 1500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 113
作問者 : %20 / テスター : nmnmnmnmnmnmnm
お気に入りにしたユーザー ProblemId : 2413 / 自分の提出
問題文最終更新日: 2026-07-02 05:20:11
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 227 (順位表) の他の問題:

Problem Statement

We call a tree a "Y-shaped graph" if it has no vertices of degree $4$ or more and has exactly $1$ vertex of degree $3$.
Find the number of kinds of Y-shaped graphs with $N$ vertices, modulo $10^9+7$.

Input

$N$

The input satisfies the following constraints.

  • $4 \le N \le 10^{18}$
  • $N$ is an integer.

Output

Print the number of kinds of Y-shaped graphs with $N$ vertices, modulo $10^9+7$.

Sample

Sample 1
Input
4
Output
1

There is $1$ kind of Y-shaped graph with $4$ vertices, shown in the figure below. A Y-shaped graph has at least $4$ vertices.

Sample 2
Input
7
Output
3

There are $3$ kinds of Y-shaped graphs with $7$ vertices, shown in the figure below.

Sample 3
Input
100
Output
817

Sample 4
Input
314159265358979323
Output
92208567

$N$ can be very large.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。