問題一覧 > 通常問題

No.1275 Beautiful Expression

レベル : / AI推定難易度 : 925 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 83
作問者 : 👑 qand / テスター : 57tggx
お気に入りにしたユーザー ProblemId : 5245 / 自分の提出
問題文最終更新日: 2021-05-08 01:03:51
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 272 (Weird math contest) (順位表) の他の問題:

Problem Statement

Find $\displaystyle \left( a+\sqrt{b} \right)^n + \left( a-\sqrt{b} \right)^n$.

Since this value can be very large, output it modulo $10^9+7$.

It is guaranteed that this value is an integer.

Input

$a\ b$
$n$

  • All inputs are integers.
  • $0 \le a , b \le 10^9$
  • $0 \le n \le 10^{18}$
  • There are no cases where $a^2=b$ and $n=0$.
  • $a+b+n\neq0$
  • Output

    Print a newline at the end.

    Sample

    Sample 1
    Input
    2 4
    2
    Output
    16

    Sample 2
    Input
    1 16
    5
    Output
    2882

    Sample 3
    Input
    111 111
    111
    Output
    370378144

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