返回顶部
摘要: https://www.acwing.com/problem/content/208/ 因为1~6的最小公倍数是60,所以以60为周期进行快速幂然后剩下的算余项,注意两点: 1、递推矩阵永远有这样的形式: A=A B 其中A就是用来把各步的递推结果压缩保存的矩阵(仿照快速幂) 2、越界的石子直接消失 阅读全文
posted @ 2019-09-18 18:01 Inko 阅读(193) 评论(0) 推荐(0)
摘要: ```cpp include using namespace std; typedef long long ll; inline int gcd(int a,int b){ if(!b) return a; else{ while(int i=a%b){ a=b; b=i; } return b; 阅读全文
posted @ 2019-09-18 16:59 Inko 阅读(208) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/228/ 要注意类似这种递推的除了用推公式的办法还可以用矩阵快速幂,说不定还会更快,毕竟组合数没有快速的算法。 cpp include using namespace std; typedef long long ll; 阅读全文
posted @ 2019-09-18 16:54 Inko 阅读(131) 评论(0) 推荐(0)