码迷,mamicode.com
首页 > 其他好文 > 详细

So Easy! HDU - 4565

时间:2019-12-16 22:02:35      阅读:82      评论:0      收藏:0      [点我收藏+]

标签:span   line   therefore   bec   快速   because   math   inline   矩阵   

易知,有\(S_n = \lceil{a + \sqrt{b}}\rceil ^ n\)
\(\because a ^ 2 - 1 < b < a ^ 2\)
\(\therefore a - \sqrt{b} \in [0, 1]\)
\(\therefore (a - \sqrt{b}) ^ n \in [0, 1]\)
\(\therefore \lceil{a + \sqrt{b}}\rceil ^ n = (a + \sqrt{b}) ^ n + (a - \sqrt{b}) ^ n\)
\(\therefore \lceil{a + \sqrt{b}}\rceil ^ n = x_1 ^ n + x_2 ^ n\)
\(\therefore 有特征方程: x ^ 2 - (x_1 + x_2) * x + x_1 * x_2 = 0\)
\(\therefore 此特征方程为 t ^ 2 - 2at + a ^ 2 - b = 0 的特征方程\)
\(\therefore 构造F_n = 2a * F_{n - 1} + (b - a ^ 2)F_{n - 2}, 矩阵快速幂即可。\)

So Easy! HDU - 4565

标签:span   line   therefore   bec   快速   because   math   inline   矩阵   

原文地址:https://www.cnblogs.com/yangxuejian/p/12051469.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!