1. 程式人生 > >CodeChef February Challenge 2018 Broken Clock (三角函數推導 + 矩陣快速冪)

CodeChef February Challenge 2018 Broken Clock (三角函數推導 + 矩陣快速冪)

bsp clas cos and red load log https tar

題目鏈接 Broken Clock 中文題面鏈接

令$cos(xα) = f(x)$

根據三角函數變換公式有

$f(x) = \frac{2d}{l} f(x-1) - f(x-2)$

令$f(x) = \frac{g(x)}{l^{x}}$

$\frac{g(x)}{l^{x}} = \frac{2d}{l} * \frac{g(x-1)}{l^{x-1}} - \frac{g(x-2)}{l^{x-2}}$

$g(x) = 2dg(x-1) - l^{2}g(x-2)$

CodeChef February Challenge 2018 Broken Clock (三角函數推導 + 矩陣快速冪)