Live2d Test Env

随笔分类 -  数学---矩阵 规律

摘要:本题我只是个搬运工,主要是抢救补板子,所以自己就没写。https://blog.csdn.net/u013534123/article/details/78058997 题意: 大致题意是给你一个N*N的矩阵,然后告诉你阿诺德变换,即原来坐标为(x,y)的点变换一次后变成((x+y)%N,(x+2y 阅读全文
posted @ 2019-08-16 09:40 nimphy 阅读(364) 评论(0) 推荐(0) 编辑
摘要:题意:给定x0,x1,a,b,满足xi=a*xi-1+b*xi-2; 求xn,n<10^(10^6); 思路:10进制快速幂裸题。降幂来写好像也是可以的,但是循环节不是phi(mod),所以数学不好就还是用10进制快速幂吧。 10进制快速幂:复杂度O(n*log10*K^3); 复杂度也不低,所以要 阅读全文
posted @ 2019-08-02 12:03 nimphy 阅读(389) 评论(0) 推荐(0) 编辑
摘要:题意:有K种珍珠,每种N颗,求长度为1~N的项链,包含K种珍珠的项链种类数。N<=1e9, K<=30; 思路:矩阵快速幂,加个1累加前缀和即可。 阅读全文
posted @ 2019-07-16 17:26 nimphy 阅读(312) 评论(0) 推荐(0) 编辑
摘要:pro:N个数排成一圈。一次操作为,每个位置的数+=L*左+R*右,保留x为整数。 问S轮操作后每个位置的值。 N<=1000,S<=2^30,x<=9 。 sol:不难想到矩阵乘法,但是N为1000,显然普通的N^3矩阵乘法的复杂度不能AC。 不难发现这是经典的循环矩阵(第二行为第一行右移一格.. 阅读全文
posted @ 2019-06-10 11:03 nimphy 阅读(457) 评论(0) 推荐(0) 编辑
摘要:A.数学等式 数据比较小,可以暴力+折半枚举。 #include<bits/stdc++.h> #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; const int maxn=2000 阅读全文
posted @ 2019-03-30 09:26 nimphy 阅读(510) 评论(0) 推荐(0) 编辑
摘要:We consider problems concerning the number of ways in which a number can be written as a sum. If the order of the terms in the sum is taken into accou 阅读全文
posted @ 2018-12-27 13:13 nimphy 阅读(248) 评论(0) 推荐(0) 编辑
摘要:题意:给出,三个函数,h,b,a,然后T次询问,每次给出n,求sqrt(an); 思路:不会推,但是感觉a应该是线性的,这个时候我们就可以用BM线性递推,自己求出前几项,然后放到模板里,就可以求了。 数据范围在1e15,1000组都可以秒过。 ( 那么主要的问题就是得确保是线性的,而且得求出前几项。 阅读全文
posted @ 2018-10-31 21:54 nimphy 阅读(346) 评论(0) 推荐(0) 编辑
摘要:题面太丑了,就不复制了。 题意:F1=A; F2=B; Fn=D*Fn-1+C*Fn-2+P/i;求Fn。 思路:根据P/i的值划分区间,每个区间矩阵求。 带常数的矩阵: 阅读全文
posted @ 2018-10-22 09:42 nimphy 阅读(150) 评论(0) 推荐(0) 编辑
摘要:Bob's school has a big playground, boys and girls always play games here after school. To protect boys and girls from getting hurt when playing happil 阅读全文
posted @ 2018-10-19 16:27 nimphy 阅读(547) 评论(0) 推荐(0) 编辑
摘要:There is a nonnegative integer sequence a 1...n a1...n of length n n . HazelFan wants to do a type of transformation called prefix-XOR, which means a  阅读全文
posted @ 2018-10-18 14:37 nimphy 阅读(127) 评论(0) 推荐(0) 编辑
摘要:有M个球,一开始每个球均有一个初始标号,标号范围为1~N且为整数,标号为i的球有ai个,并保证Σai = M。 每次操作等概率取出一个球(即取出每个球的概率均为1/M),若这个球标号为k(k < N),则将它重新标号为k + 1;若这个球标号为N,则将其重标号为1。(取出球后并不将其丢弃) 现在你需 阅读全文
posted @ 2018-09-18 19:47 nimphy 阅读(370) 评论(0) 推荐(0) 编辑
摘要:On Saint Valentine's Day, Alex imagined to present a special pendant to his girl friend made by K kind of pearls. The pendant is actually a string of 阅读全文
posted @ 2018-09-18 19:26 nimphy 阅读(249) 评论(0) 推荐(0) 编辑
摘要:A cellular automaton is a collection of cells on a grid of specified shape that evolves through a number of discrete time steps according to a set of 阅读全文
posted @ 2018-09-18 16:26 nimphy 阅读(232) 评论(0) 推荐(0) 编辑
摘要:题意:输入N,输出fib(2^N)%1125899839733759。(P=1125899839733759是素数) 思路:欧拉降幂,因为可以表示为矩阵乘法,2^N在幂的位置,矩阵乘法也可以降幂,所以有ans=a*base^num; num=2^N%(P-1)。 阅读全文
posted @ 2018-09-18 15:31 nimphy 阅读(217) 评论(0) 推荐(0) 编辑
摘要:Magic Land上的人们总是提起那个传说:他们的祖先John在那个东方岛屿帮助Koishi与其姐姐Satori最终战平。而后,Koishi恢复了读心的能力…… 如今,在John已经成为传说的时代,再次造访那座岛屿的人们却发现Koishi遇到了新麻烦。 这次她遇到了Flandre Scarlet— 阅读全文
posted @ 2018-07-02 19:31 nimphy 阅读(335) 评论(0) 推荐(0) 编辑
摘要:Barney was hanging out with Nora for a while and now he thinks he may have feelings for her. Barney wants to send her a cheesy text message and wants 阅读全文
posted @ 2018-07-01 18:37 nimphy 阅读(338) 评论(0) 推荐(0) 编辑
摘要:题意:给出N,以及三个矩阵A,B,C,大小都为N*N。问是否满足A*B=C; N<1000; 思路:由于矩阵乘法的复杂度为O(N^3);而部分验证又不能保证结果正确。我们巧妙地利用矩阵乘法的结合律:使其变为1*N和N*N的矩阵乘法,使复杂度降低为O(N^2); 即随机构造矩阵X(1*N),Y(N*1 阅读全文
posted @ 2018-06-25 21:18 nimphy 阅读(331) 评论(0) 推荐(0) 编辑
摘要:Problem description. The Fibonacci numbers defined as f(n) = f(n-1) + f(n-2) where f0 = 0 and f1 = 1. We define a function as follows D(n,x) = x + x^2 阅读全文
posted @ 2018-04-20 22:19 nimphy 阅读(435) 评论(0) 推荐(0) 编辑
摘要:引例: Matrix Power Series: 题目大意,给定矩阵A,求A^1+A^2+A^3+...A^N。 题解:已知X=a,可以通过以下矩阵求出ans=a^1+a^2+...a^N ans=矩阵^n后第一行之和-1=矩阵^(n+1)后右上格的和-1。 同理:矩阵也可以,只需要把1改为单位矩阵 阅读全文
posted @ 2018-02-27 15:25 nimphy 阅读(3947) 评论(0) 推荐(0) 编辑
摘要:以前KMP和后缀系列(主要是后缀数组,后缀自动机),都刷了一定数量的题,但是对于AC自动机,却有些冷落,罪过。 但是我感觉,在蓝桥杯比赛中AC自动机出现的概率比后缀系列大,简单的会考匹配,稍难一点会考AC自动机+DP ,AC自动机+矩阵乘法,或者套其他算法blabla... Trie图是AC自动机的 阅读全文
posted @ 2018-02-24 14:13 nimphy 阅读(307) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示