题意:已知N*N的矩阵A,输出矩阵A + A2 + A3 + . . . + Ak,每个元素只输出最后一个数字。 分析: A + A2 + A3 + . . . + An可整理为下式, 从而可以用log2(n)的复杂度算出结果。 注意:输入时把矩阵A的每个元素对10取余,因为若不处理,会导致k为1的 ...
分类:
其他好文 时间:
2017-07-30 23:52:33
阅读次数:
220
题目链接:poj 2406 Power Strings 题意: 给你一个字符串,让你找出这个字符串的最大循环次数,及最小循环节。 题解: 用kmp的nxt数组搞搞,L=j-nxt[j],为前缀j的最小循环节。 1 #include<cstdio> 2 #include<algorithm> 3 #i ...
分类:
编程语言 时间:
2017-07-30 22:03:33
阅读次数:
221
LeetCode 第 342 题(Power of Four) Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, retu ...
分类:
其他好文 时间:
2017-07-30 20:04:11
阅读次数:
121
1. 首先到官网把插件下载下来 2. 将文件导入到工程,在前端页面将插件引入 3. 导入界面 4. js处理 5. 后台接口 6. 附ExcelUtil类 ...
分类:
其他好文 时间:
2017-07-30 15:46:04
阅读次数:
327
今天看算法书的时候,看到一道关于快速幂取模的题,心想好像不难,便写了一下,发现我的渣渣代码写的比正常的O(N)复杂度还要慢(天知道我怎么做到的T_T),渣渣代码如下: 于是只好从最基本的复杂度O(N)的算法来看我哪错了当计算x的n次方余m的值时,正常做法一般是复杂度O(N)的做法,如下: 这种做法就 ...
分类:
其他好文 时间:
2017-07-29 22:24:21
阅读次数:
213
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL;... ...
分类:
其他好文 时间:
2017-07-29 20:22:03
阅读次数:
118
https://vjudge.net/problem/POJ-2406 题意: 求一个字符串的最小循环节的循环次数。 思路: 参考了白书的213页的例题,如何求循环节的长度,用kmp算法所得到的失配函数进行求解。循环节的长度是i - f[i]。因此这题直接用len / (len-f[len]) 求解 ...
分类:
其他好文 时间:
2017-07-29 01:03:57
阅读次数:
185
how to upgrade ubnt unifi acopenwrthow to upgrade uap-ac-pro to okos imageReferenceBackgroundstepsRecovery it to UBNT ImageBackgroundSteps how to upgr... ...
分类:
其他好文 时间:
2017-07-28 23:56:04
阅读次数:
264
(一)使用NavigationViewController进行页面跳转时,应该使用pushViewController方法来跳转至下一页面。这种话。下一页面相同在NavigationViewController容器中。 1、跳转到下一页面: PowerViewController *power = ...
分类:
移动开发 时间:
2017-07-27 20:28:13
阅读次数:
262
题意:求A + A^2 + A^3 + ... + A^m。 析:主要是两种方式,第一种是倍增法,把A + A^2 + A^3 + ... + A^m,拆成两部分,一部分是(E + A^(m/2))(A + A^2 + A^3 + ... + A^(m/2)),然后依次计算下去,就可以分解,logn ...
分类:
其他好文 时间:
2017-07-27 12:43:27
阅读次数:
159