码迷,mamicode.com
首页 >  
搜索关键字:matrix chain multipl    ( 5757个结果
树的遍历——A1106.Lowest Price in Supply Chain(25) 求树的深度最小的叶子结点 与A1190类似
#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; vector<int> child[maxn] ...
分类:其他好文   时间:2020-01-27 22:04:05    阅读次数:73
【leetcode】1329. Sort the Matrix Diagonally
题目如下: Given a m * n matrix mat of integers, sort it diagonally in ascending order from the top-left to the bottom-right then return the sorted array. ...
分类:其他好文   时间:2020-01-27 19:06:23    阅读次数:72
快速幂与矩阵快速幂
幂运算 幂运算$a^b$是$b$个$a$相乘的结果. C++自带的幂函数 是最朴素的$O(b)$算法,效率非常低,所以如果要用到大量幂运算,最好自己打一个快速幂. 快速幂 求$a^b\%p$的值. 1. 当$b=1$时,返回$a%p$. 2. 当$2\mid b$时,返回$pow(a,\frac{b ...
分类:其他好文   时间:2020-01-27 00:19:32    阅读次数:99
Python与线性代数——Numpy中的matrix()和array()的区别
Numpy中matrix必须是2维的,但是 numpy中array可以是多维的(1D,2D,3D····ND)。matrix是array的一个小的分支,包含于array。所以matrix 拥有array的所有特性。 matrix() 和 array() 的区别,主要从以下方面说起: 矩阵生成方式不同 ...
分类:编程语言   时间:2020-01-26 23:46:59    阅读次数:150
树的遍历——A1079.Total Sales of Supply Chain(25) 与A1090类似
#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; struct node{ double dat ...
分类:其他好文   时间:2020-01-26 22:04:59    阅读次数:96
PAT 甲级 1105 Spiral Matrix (25分)(螺旋矩阵,简单模拟)
1105 Spiral Matrix (25分) This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix ...
分类:其他好文   时间:2020-01-26 20:50:27    阅读次数:84
树的遍历——A1090 Highest Price in Supply Chain(25)(使用vector<Int> temp[maxn]来当作树)
#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; vector<int> child[maxn] ...
分类:其他好文   时间:2020-01-26 20:49:51    阅读次数:111
c++ 行为型模式-责任链(Chain of Responsibility)
1) 意图 使多个对象连成一条链,沿着这条链传递请求,直到有个对象处理它为止。 2) 结构 其中: Handler定义一个处理请求的接口 ConcreteHandler处理它所负责的请求 Client向链上具体处理提交请求 3) 适用性 有多个对象可以处理一个请求,哪个对象处理该请求运行时刻自动确定 ...
分类:编程语言   时间:2020-01-25 22:12:08    阅读次数:81
[Matrix-Tree][插值][容斥][prufer序列][DP]夕张的改造
源自 krydom 大爷的 FJ 省冬令营模拟赛题 Statement 给定一棵 $n$ 个点的树和一个参数 $k$ 每次操作可以选出树上的一条边删掉,然后再加一条边,使得操作之后还是一棵树 求 $k$ 次操作能得到多少种不同的树,对 $998244353$ 取模 $n\le 50$(原题数据范围) ...
分类:其他好文   时间:2020-01-25 15:25:34    阅读次数:83
算法测试一复习
【算法正确性】所有的输入,都能停止,并有有正确的输出 【算法选择】易懂:),优雅:),高效:)(时间+空间) 【插入排序】左边的永远是已经拍好序的best case: T(n) = an + b; worst case: T(n) = an^2 + bn + c 【θ】θ(g(n)) = {f(n) ...
分类:编程语言   时间:2020-01-24 16:04:44    阅读次数:80
5757条   上一页 1 ... 45 46 47 48 49 ... 576 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!