E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
acm_矩阵快速幂
[
ACM_
动态规划] hdu 1176 免费馅饼 [变形数塔问题]
Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老
·
2015-10-31 11:36
动态规划
[
ACM_
模拟] ACM - Draw Something Cheat [n个长12的大写字母串,找出交集,按字母序输出]
Description Have you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You
·
2015-10-31 11:36
ACM
[
ACM_
数学] LA 3708 Graveyard [墓地雕塑 圈上新加点 找规律]
Description Programming contests became so popular in the year 2397 that the governor of New Earck -- the largest human-inhabited planet of the galaxy -- opened a special Alley of
·
2015-10-31 11:36
ACM
[
ACM_
水题] UVA 11292 Dragon of Loowater [勇士斗恶龙 双数组排序 贪心]
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime breeding ground for g
·
2015-10-31 11:36
water
[
ACM_
模拟][
ACM_
数学] LA 2995 Image Is Everything [由6个视图计算立方体最大体积]
Description Your new company is building a robot that can hold small lightweight objects. The robot will have the intelligence to determine if an object is light enough to hold. It
·
2015-10-31 11:36
image
[
ACM_
图论] The Perfect Stall 完美的牛栏(匈牙利算法、最大二分匹配)
描述 农夫约翰上个星期刚刚建好了他的新牛棚,他使用了最新的挤奶技术。不幸的是,由于工程问题,每个牛栏都不一样。第一个星期,农夫约翰随便地让奶牛们进入牛栏,但是问题很快地显露出来:每头奶牛都只愿意在她们喜欢的那些牛栏中产奶。上个星期,农夫约翰刚刚收集到了奶牛们的爱好的信息(每头奶牛喜欢在哪些牛栏产奶)。一个牛栏只能容纳一头奶牛,当然,一头奶牛只能在一个牛栏中产奶。 给出奶牛们的爱好的信息,计算最
·
2015-10-31 11:35
ACM
[
ACM_
搜索] ZOJ 1103 || POJ 2415 Hike on a Graph (带条件移动3盘子到同一位置的最少步数 广搜)
Description "Hike on a Graph" is a game that is played on a board on which an undirected graph is drawn. The graph is complete and has all loops, i.e. for any two locations there is exactly
·
2015-10-31 11:35
Graph
[
ACM_
图论] Fire Net (ZOJ 1002 带障碍棋盘布炮,互不攻击最大数量)
Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small cas
·
2015-10-31 11:35
ACM
[
ACM_
图论] Sorting Slides(挑选幻灯片,二分匹配,中等)
Description Professor Clumsey is going to give an important talk this afternoon. Unfortunately, he is not a very tidy person and has put all his transparencies on one big heap. Before giving the talk
·
2015-10-31 11:35
sort
[
ACM_
搜索] Triangles(POJ1471,简单搜索,注意细节)
Description It is always very nice to have little brothers or sisters. You can tease them, lock them in the bathroom or put red hot chili in their sandwiches. But there is also a time when all meanne
·
2015-10-31 11:35
ACM
[
ACM_
动态规划] ZOJ 1425 Crossed Matchings(交叉最大匹配 动态规划)
Description There are two rows of positive integer numbers. We can draw one line segment between any two equal numbers, with values r, if one of them is located in the first row and the other one is
·
2015-10-31 11:35
match
[
ACM_
搜索] POJ 1096 Space Station Shielding (搜索 + 洪泛算法Flood_Fill)
Description Roger Wilco is in charge of the design of a low orbiting space station for the planet Mars. To simplify construction, the station is made up of a series of Airtight Cubical Modules (ACM's
·
2015-10-31 11:35
ACM
[
ACM_
几何] Transmitters (zoj 1041 ,可旋转半圆内的最多点)
Description In a wireless network with multiple transmitters sending on the same frequencies, it is often a requirement that signals don't overlap, or at least that they don't conflict. One way of a
·
2015-10-31 11:35
ACM
[
ACM_
模拟] The Willy Memorial Program (poj 1073 ,联通水管注水模拟)
Description Willy the spider used to live in the chemistry laboratory of Dr. Petro. He used to wander about the lab pipes and sometimes inside empty ones. One night while he was in a pipe, he fell as
·
2015-10-31 11:35
ACM
[
ACM_
其他] Square Ice (poj1099 规律)
Description Square Ice is a two-dimensional arrangement of water molecules H2O, with oxygen at the vertices of a square lattice and one hydrogen atom between each pair of adjacent oxygen atoms. The
·
2015-10-31 11:35
ACM
[
ACM_
图论] Highways (变形说法的最小生成树)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28972#problem/C 题目给出T种情况,每种情况有n个城镇,接下来每一行是第i个城镇到所有城镇的距离(其实就是个可达矩阵)。 求建设一条公路联通所有城镇并且要求最长的一段最小(其实就是最小生成树)!代码如下: #include<
·
2015-10-31 11:34
最小生成树
[
ACM_
数学] Counting Solutions to an Integral Equation (x+2y+2z=n 组合种类)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27938#problem/E 题目大意:Given, n, count the number of solutions to the equation x+2y+2z=n, where x,y,z,n are non negative inte
·
2015-10-31 11:34
count
[
ACM_
几何] The Deadly Olympic Returns!!! (空间相对运动之最短距离)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28235#problem/B 题目大意: 有两个同时再空间中匀速运动的导弹,告诉一个时间以及各自的初始坐标和该时间时的坐标,求运动过程中的最短距离 解题思路: 求出相对初位置、相对速度,则答案就是原点到射线型轨迹的距离,注意是射线!!!
·
2015-10-31 11:34
return
[
ACM_
几何] F. 3D Triangles (三维三角行相交)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28235#problem/A 题目大意:给出三维空间两个三角形三个顶点,判断二者是否有公共点,三角形顶点、边、内部算三角形的一部分。 解题思路:见模板 //**********************************************
·
2015-10-31 11:34
ACM
[
ACM_
动态规划] 轮廓线动态规划——铺放骨牌(状态压缩1)
Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on
·
2015-10-31 11:34
动态规划
[
ACM_
图论] 棋盘问题 (棋盘上放棋子的方案数)
不能同行同列,给定形状和大小的棋盘,求摆放k个棋子的可行方案 Input 2表示是2X2的棋盘,1表示k,#表示可放,点不可放(-1 -1 结束) Output 输出摆放的方案数目C Sample Input 2 1 #. .# 4 4 ...# ..#. .#.. #... -1 -1 Sample Output 2 1
·
2015-10-31 11:34
ACM
[
ACM_
其他] 总和不小于S的连续子序列的长度的最小值——尺缩法
Description: 给定长度为n的整数数列,A[0],A[1],A[2]….A[n-1]以及整数S,求出总和不小于S的连续子序列的长度的最小值。如果解不存在,则输出0。 Input: 输入数据有多组,每组数据第一行输入n,S, (10<n<10^5,S<10^8)第二行输入A[0],A[1],A[2]….A[n-1] ( 0<A[i]≤10000)
·
2015-10-31 11:34
ACM
[
ACM_
几何] Metal Cutting(POJ1514)半平面割与全排暴力切割方案
Description In order to build a ship to travel to Eindhoven, The Netherlands, various sheet metal parts have to be cut from rectangular pieces of sheet metal. Each part is a convex polygon with at mo
·
2015-10-31 11:34
meta
[
ACM_
动态规划] Palindrome
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28415#problem/D 题目大意:给一个长为n的字符串,问最少插入几个字符成回文串 解题思路:总长-最长公共(原来的和其倒过来的串)子序列(LCS) 知识详解——LCS:给出两个子序列A,B,求长度最大的公共子序列(如152687和2356984——
·
2015-10-31 11:33
动态规划
[
ACM_
动态规划] Alignment (将军排队)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28415#problem/F 题目大意:有n个士兵排成一列,将军想从中抽出最少人数使队伍中任何士兵都能够看到左边最远处或右边最远处 解题思路:①此题是最长上升子序列的升级版。 &
·
2015-10-31 11:33
动态规划
[
ACM_
贪心] Radar Installation
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28415#problem/A 题目大意:X轴为海岸线可放雷达监测目标点,告诉n个目标点和雷达监测半径,求最少多少个雷达可全覆盖,如果不能输出-1; 解题思路:赤裸裸的区间选点问题(数轴上有n个闭区间,去尽量少的点,使每个区间至少有一个点)。核心思想就是贪心算法:把所有区间按照b从小
·
2015-10-31 11:33
Install
[
ACM_
几何] Pipe
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28417#problem/B 本题大意: 给定一个管道上边界的拐点,管道宽为1,求一束光最远能照到的地方的X坐标,如果能照到终点,则输出...  
·
2015-10-31 11:33
ACM
[
ACM_
几何] Wall
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28417#problem/E 题目大意:依次给n个点围成的一个城堡,在周围建围墙,要求围墙离城墙的距离大于一定的值,求围墙最短长度(结果四舍五入 解题思路:求围住所有点的凸包周长+一个圆的周长 #include<iostream> #include<cma
·
2015-10-31 11:33
ACM
矩阵快速幂
模板
数据结构 struct Mat{ ll mat[3][3]; void init(){ for (int i = 0; i < 2; ++i){ for (int j = 0; j < 2; ++j){ mat[i][j] = ; } }
·
2015-10-31 11:47
模板
POJ 3233 Matrix Power Series(
矩阵快速幂
+二分)
Time Limit: 3000MS Memory Limit: 131072K Total Submissions: 16986 Accepted: 7233 Description Given a n × n matrix A an
·
2015-10-31 11:50
Matrix
(
矩阵快速幂
)
How many ways?? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1912 Accepted Submission(s): 692 Pr
·
2015-10-31 11:49
HDU
HDU 1757 A Simple Math Problem(
矩阵快速幂
)
a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10); 给 k 和 m,求 f(k) % m的值 样例解释: 略 解题思路: 用
矩阵快速幂
·
2015-10-31 11:32
simple
hdu1588
矩阵快速幂
//看了很多的博客 后来队友指点才懂//sum=f(g(0))+f(g(1))+.... //sum=A^(b-1)*|...|.... //要将b-1换,防止出现b=0时有负一,用A^b代替,取下面的即可 //这样问题成了 sum=A^b(A+A^(2k)+A^(3k)+...+A^(k(n-1))); //令B=A^k次,就简单了。 /* 主要要求1+A+A^2+A^3+.
·
2015-10-31 11:01
HDU
poj 3744 概率dp+
矩阵快速幂
题意:在一条布满地雷的路上,你现在的起点在1处。在N个点处布有地雷,1<=N<=10。地雷点的坐标范围:[1,100000000]. 每次前进p的概率前进一步,1-p的概率前进1-p步。问顺利通过这条路的概率。就是不要走到有地雷的地方。 链接:点我 设dp[i]表示到达i点的概率,则 初始值 dp[1]=1. 很容易想到转移方程: dp[i]=p*
·
2015-10-31 10:28
poj
Hdu 4291
找到循环节之后,另一个知识点就是对于线性关系可以使用
矩阵快速幂
来加速。
·
2015-10-31 10:34
HDU
HDU 2604
矩阵快速幂
题目大意 给定长度为l的只有f,m两种字母 的序列,问不出现fff,fmf的序列个数有多少个 每次的下一个状态都与前一次状态的后两个字母有关 比如我令mm : 0 , mf : 1 , fm : 2 , ff : 3; 那么dp[i][j] 表示长度为i的序列最后由j状态结尾的总个数,当然 j 要大于2 dp[i][0] = dp[i-1][0] + dp[i-1][2]
·
2015-10-31 10:11
HDU
矩阵快速幂
——将运算推广到矩阵上HDU 1575
/* 本题的思路比较简单,就是将递推公式写出来,然后表达成为一个矩阵的形式 最后通过计算就可以得到一个符合题目要求的矩阵, 然后就是将矩阵上面所有的对角线元素相加 得到的结果即为所求的目标 */ #include<cstdio> #include<cstring> using namespace std; const int
·
2015-10-31 10:56
HDU
hdu 4549
矩阵快速幂
题意: M斐波那契数列F[n]是一种整数数列,它的定义如下:F[0] = aF[1] = bF[n] = F[n-1] * F[n-2] ( n > 1 )现在给出a, b, n,你能求出F[n]的值吗? 链接:点我 这题的话,看a ,b 的指数,刚好可以使用斐波那契数列求解。 然后用矩阵做。 A^B %C 这题的C是质素,而且
·
2015-10-31 09:06
HDU
HDU 1575 Tr A
矩阵快速幂
#include<cstdio> #include<cstring> #include<cmath> #include<algorithm
·
2015-10-31 09:30
HDU
hdu 5015 233
矩阵快速幂
http://acm.hdu.edu.cn/showproblem.php?pid=5015 需要构造一个 n+2 维的矩阵。 就是要增加一维去维护2333这样的序列。 可以发现 2333 = 233*10 + 3 所以增加了一维就 是1, 然后就可以全部转移了。 10 0 0 0 0 ... 1 &n
·
2015-10-31 09:33
HDU
Hdu1575Tr A矩阵
矩阵快速幂
,就是快速幂的乘法变成矩阵乘法,其余的都一样。
·
2015-10-31 09:15
HDU
矩阵快速幂
AC代码HDU 2035
#include <iostream> using namespace std;const int MOD = 1000;//像这样的一个常量就应该专门定义一下 int PowMod(int a, int n)//a^n%MOD { int ret = 1; while(n) { if(n & 1) ret = ret * a % MOD; //变为二进制,然后就可以专门进
·
2015-10-31 09:42
HDU
HDU 4549 M斐波那契数列(
矩阵快速幂
+欧拉定理)
M斐波那契数列 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 353 Accepted Submission(s): 93 Problem Desc
·
2015-10-31 09:16
HDU
Training little cats(poj3735,
矩阵快速幂
)
Training little cats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10737 Accepted: 2563 Description Facer's pet cat just gave birth to a
·
2015-10-31 09:37
poj
Power of Matrix(uva11149+
矩阵快速幂
)
Power of Matrix Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 11149
·
2015-10-31 09:37
Matrix
矩阵快速幂
取模
参考博客1: 据说,
矩阵快速幂
在递推式优化上相当神奇,而且效率很高。。。 两矩阵相乘,朴素算法的复杂度是O(N^3)。
·
2015-10-31 09:37
矩阵
M斐波那契数列(
矩阵快速幂
+费马小定理)
M斐波那契数列 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1672 Accepted Submission(s): 482 Problem Des
·
2015-10-31 09:36
矩阵
BestCoder Round #29——A--GTY's math problem(快速幂(对数法))、B--GTY's birthday gift(
矩阵快速幂
)
GTY's math problem Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 0 Accepted Submission(s): 0
·
2015-10-31 09:36
round
Algebra(
矩阵快速幂
,uva10655)
Problem E Contemplation! Algebra Input: Standard Input Output: Standard Output Time Limit: 1 Second Given the value of a+b and ab you will have to find
·
2015-10-31 09:36
uva
hdu 4565 So Easy!(矩阵+快速幂)
题目大意:就是给出a,b,n,m;让你求s(n); 解题思路:因为n很可能很大,所以一步一步的乘肯定会超时,我建议看代码之前,先看一下快速幂和
矩阵快速幂
,这样看起来就比较容易,这里我直接贴别人的推导
·
2015-10-31 08:58
HDU
上一页
27
28
29
30
31
32
33
34
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他