矩阵快速幂
creator平
期望破茧成蝶时的飞翔,向往突破蝉蛹后的鸣叫。
展开
-
矩阵快速幂
矩阵快速幂与快速幂有异曲同工之处:快速幂:int ksm(int n,int k)//n的k次方{ int ans=1; while(k) { if(k&1) { ans*=n; } k/=2; n*=n; } return ans;}矩阵乘法...原创 2018-04-01 15:56:01 · 117 阅读 · 0 评论 -
Kattis - secretchamber
By now you have probably heard that there is a spectacular stone sculpture featuring four famous U.S. presidents at Mount Rushmore. However, very few people know that this monument contains a secret c...原创 2018-04-13 14:54:42 · 230 阅读 · 0 评论 -
POJ - 3233 ——Matrix Power Series (矩阵乘矩阵)
Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. Input The input contains exactly one test case. The first line of input con...原创 2018-04-28 08:25:29 · 186 阅读 · 0 评论 -
CSU - 1895——Apache is late again ( (1 + sqrt (2)) ^ n = sqrt (m) + sqrt (m-1) 求m)
Apache is a student of CSU. There is a math class every Sunday morning, but he is a very hard man who learns late every night. Unfortunate, he was late for maths on Monday. Last week the math teacher ...原创 2018-05-21 09:28:31 · 313 阅读 · 0 评论