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
1195
poj
1195
题目一道二维树状数组的裸题。把更新,求和函数改成二维即可求和的时候注意要getsum(x2,y2)-getsum(x1-1,y2)-getsum(x2,y1-1)+getsum(x1-1,y1-1)画图即可理解。代码如下:#include#include#includeusingnamespacestd;constintmaxn=1050;inta[maxn][maxn];intn;intLowb
黄小豪被虐惨了
·
2020-09-15 15:05
ACM-数据结构
线段树&&树状数组
bzoj
1195
[HNOI2006]最短母串
http://www.elijahqi.win/archives/3512Description给定n个字符串(S1,S2,„,Sn),要求找到一个最短的字符串T,使得这n个字符串(S1,S2,„,Sn)都是T的子串。Input第一行是一个正整数n(n#include#include#include#definefifirst#definesesecond#definepapair#definem
elijahqi
·
2020-09-15 13:54
动态规划
AC自动机
【bzoj
1195
】[HNOI2006]最短母串
此题似乎是一个dp。。dp[i][j]表示选了i这个集合的字符串,最后一个是j的最短字符串。(字典序顺便搞定)然后发现需要处理掉一串为另一串子串的情况,特判一些特殊情况(或者奇怪的姿势)就好了。。这题很卡空间,请务必不要乱开数组。#include#definegcgetchar()usingnamespacestd;intn,len[13],Len[13];intlength[4096][13],
wzf_2000
·
2020-09-14 08:06
bzoj
dp
字符串
dp
字符串
c++
【HNOI2006】bzoj
1195
最短母串
Description给定n个字符串(S1,S2,„,Sn),要求找到一个最短的字符串T,使得这n个字符串(S1,S2,„,Sn)都是T的子串。Input第一行是一个正整数n(n#include#includeusingnamespacestd;constintoo=0x3f3f3f3f;structstr{chars[602];intl;voidrd(){scanf("%s",s+1);l=st
sdfzyhx
·
2020-09-14 07:41
动态规划
bzoj
省选真题
HNOI 2006 BZOJ
1195
最短母串
题面问题描述给定n个字符串(S1,S2,„,Sn),要求找到一个最短的字符串T,使得这n个字符串(S1,S2,„,Sn)都是T的子串。输入第一行是一个正整数n(n#include#includeconstintN=12,LEN=50;intn;charans[N*LEN];structACautomaton{structnode{node*suc[26],*fl;intvst[1fl=rt;}in
dk810510
·
2020-09-14 06:20
[bzoj
1195
][HNOI2006]最短母串_动态规划_状压dp
最短母串bzoj-
1195
HNOI-2006题目大意:给一个包含n个字符串的字符集,求一个字典序最小的字符串使得字符集中所有的串都是该串的子串。
dianan0938
·
2020-09-14 06:16
Bzoj
1195
[HNOI2006]最短母串 [状态压缩]
TimeLimit:10SecMemoryLimit:32MBSubmit:1304Solved:439Description给定n个字符串(S1,S2,„,Sn),要求找到一个最短的字符串T,使得这n个字符串(S1,S2,„,Sn)都是T的子串。Input第一行是一个正整数n(n2#include3#include4#include5#include6usingnamespacestd;7con
dezhen7015
·
2020-09-14 06:15
bzoj
1195
[HNOI2006]最短母串(ACAM+状压+bfs)
建出ACAM,然后装压到每个点的串匹配状态。最短的字典序最小的,于是我们贪心地从小到大bfs。复杂度O(nm2n)O(nm2n)这题卡内存真是酸爽【再见】#includeusingnamespacestd;#definelllonglong#defineinf0x3f3f3f3f#defineN602#definepapairintn,son[N][26],fail[N],ed[N],pre1[N
Icefox_zhx
·
2020-09-14 06:08
bzoj
ACAM
状压dp
贪心
大视野
1195
: [HNOI2006]最短母串
题目Description给定n个字符串(S1,S2,„,Sn),要求找到一个最短的字符串T,使得这n个字符串(S1,S2,„,Sn)都是T的子串。Input第一行是一个正整数n(n#includestructnode{intval,path[15],cnt;}dp[15][5000];//val表示路径的长度,cnt表示路径上节点的数量,path记录了具体的节点charstr[15][55],s
栗悟饭和龟仙人
·
2020-09-14 06:57
大视野
bzoj
1195
: [HNOI2006]最短母串 状压dp
令f[i][j]表示所选的字符串的集合用二进制表示为i,最后一个字符串为j时的最短母串。那么通过预处理一个数组c[i][j]表示将j接在i后面需要拓展多少位就可以实现O(N)转移。那么状态数为O(N2^N),时间复杂度就是O(N^2·2^N)。注意到这道题目需要按字符串字典序输出,因此还需要用s[i][j]表示最短的母串中字典序最小的(必须记录整个母串否则会错,因此部分网上题解有误)。那么转移的时
lych_cys
·
2020-09-14 05:56
bzoj
poj
1195
二维树状数组 及二维树状数组模板
id=
1195
求矩阵和的时候,下标弄错WA了一次...求矩形(x1,y1)(x2,y2)的sum|sum=sum(x2,y2)-sum(x1-1,y2)-sum(x2,y1-1)+sum(x1-1,y1
Z-Pilgrim
·
2020-09-14 01:29
【树转数组】poj
1195
/*二维的树状数组:更新某个元素时:NO.1:c[n1],c[n2],c[n3],....,c[nm];其中n1=i,n(i+1)=ni+lowbit(ni);nm+lowbit(nm)的值应该大于元素个数N。NO.2:sum(k)=c[n1]+c[n2]+...+c[nm];其中nm=k,n(i-1)=ni-lowbit(ni);n1-lowbit(n1)的值应该小于0-------------
欧拉士大夫
·
2020-09-12 07:33
辛弃疾的赤子之心(下)
三公元
1195
年,辛弃疾赋闲江西,在铅山建了所新居。此时的老辛已年过五十,一头的黑发已日渐花白。一日里,老辛披着自己
采尺书庐
·
2020-09-03 19:57
LeetCode
1195
. 交替打印字符串 (互斥量、条件量)
题目描述编写一个可以从1到n输出代表这个数字的字符串的程序,但是:如果这个数字可以被3整除,输出"fizz"。如果这个数字可以被5整除,输出"buzz"。如果这个数字可以同时被3和5整除,输出"fizzbuzz"。例如,当n=15,输出:1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz。假设有这么一个类:classFizzBuzz{
baby的我
·
2020-08-25 04:36
刷题记录
poj
1195
Mobile phones 二维线段树和二维树状数组两种做法 树套树
MobilephonesTimeLimit:5000MSMemoryLimit:65536KTotalSubmissions:15849Accepted:7321DescriptionSupposethatthefourthgenerationmobilephonebasestationsintheTampereareaoperateasfollows.Theareaisdividedintosq
小小小小葱
·
2020-08-24 21:24
数据结构
真正赢得争论的方式,其实是认同对方的观点
本文
1195
字,阅读需要四分钟。我还记得,读书时的自己,特别喜欢与人争论,每次遇到与我观点相左的人时,我就会用,自己异常出众的逻辑思辨能力,每次都能找到对方观点中的翘点,把对方的观点说的一无是处。
一个圣诞老人
·
2020-08-24 20:13
宝贝和妈妈读经感恩日记
1195
篇
2018年9月19日星期三妈妈坚持讲故事第256天《快乐在于心态》;睿睿坚持讲故事第53天《让快乐来敲门》睿睿读经:《神农本草经》《伤寒论》《新概念英语》;鑫鑫读经:《易经》《成语接龙》《论语》;勋宝177听经。妈妈读老子道德经20章,累积34遍。睿睿读老子道德经0章累计22遍。睿睿读《成语接龙》1遍,累积5遍。学习收获:重要的决策不要受情绪的影响,让情绪沉淀一下,隔夜再决定就会发现没那么严重,这
福建睿鑫勋妈
·
2020-08-24 09:46
(多线程)
1195
. 交替打印字符串
编写一个可以从1到n输出代表这个数字的字符串的程序,但是:如果这个数字可以被3整除,输出"fizz"。如果这个数字可以被5整除,输出"buzz"。如果这个数字可以同时被3和5整除,输出"fizzbuzz"。例如,当n=15,输出:1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz。假设有这么一个类:classFizzBuzz{publ
black_horse2018-Dong
·
2020-08-23 23:35
多线程
leetcode
1195
. 交替打印字符串
目录1、用一个信号量,毫无关系的并发中,可以使用信号量充当一个流动的锁。最好用Atomicinteger类似于cas自旋1、用一个信号量,毫无关系的并发中,可以使用信号量充当一个流动的锁。最好用Atomicinteger类似于cas自旋编写一个可以从1到n输出代表这个数字的字符串的程序,但是:如果这个数字可以被3整除,输出“fizz”。如果这个数字可以被5整除,输出“buzz”。如果这个数字可以同
Flag_died
·
2020-08-23 23:30
多线程
面试中你肯定遇到过这5个坑,新年想找好工作,就要懂得这3条
点击右上角【关注】霸王课~每天收获一个最实用的职场技能干货~全文约
1195
字|阅读时长4分钟面试几乎是每一个职场人的人生必经之路,有的人通过面试获得了难得的工作机会,从此职业发展顺利,走上人生巅峰;然而有的人却在面试中屡屡受挫
霸王课
·
2020-08-22 21:24
1195
:判断整除
1195
:判断整除【题目描述】一个给定的正整数序列,在每个数之前都插入+号或−号后计算它们的和。
hipoole
·
2020-08-22 01:56
信息学奥数一本通
ybt
1195
判断整除
ybt
1195
判断整除时空限制1000ms/64MB【题目描述】一个给定的正整数序列,在每个数之前都插入+号或-号后计算它们的和。
WDAJSNHC
·
2020-08-22 01:10
动态规划
壶洲记事
大宋嘉和年间(西元
1195
年),周国捕奴船于东昆仑沿岸逢大风浪,偏离航线,竟于昆仑洲东南发现一大岛。
人鱼王之矛
·
2020-08-21 16:59
51nod
1195
:斐波那契数列的循环节 (二次剩余+常系数线性递推)
传送门题意:求Fib数列在modn意义下的循环节。题解:首先,将n分解质因数,得n=pk11pk22..pkcc。设G(x)为modx下的循环节。显然有:G(n)=lcmi=1c(G(pkii))至于求pkii的循环节具体请看论文:https://wenku.baidu.com/view/7fc328eb4693daef5ef73d87.html步骤为:若p≤5,则直接返回值(小于5不满足以下性质
DZYO
·
2020-08-21 01:25
二次剩余
常系数齐次线性递推
左右鞋的java多线程,哪位大师帮忙优化一下?
22个线程1个打包1个指挥20个负责生产左右鞋.左鞋300ms右鞋700ms优化的极限是
1195
哪位大师帮忙优化一下?
天天实习
·
2020-08-20 16:58
java
java
左右鞋的java多线程,哪位大师帮忙优化一下?
22个线程1个打包1个指挥20个负责生产左右鞋.左鞋300ms右鞋700ms优化的极限是
1195
哪位大师帮忙优化一下?
天天实习
·
2020-08-20 16:58
java
hdu
1195
open the lock BFS
/*题目大意:有一个紧急开启密码锁的任务。密码由四位数字组成;每个数字从1到9;每次,可以对每一个数字进行加1或者减1;当从1加到9时,由9再加1会变为1;当从9减到1时,由1再减1会变为9;也可以交换两个相邻的数字,每次操作作为一个step。你的任务就是用最少的步骤解锁!首先考虑1234的下一step有可能是什么样的数字针对每一位数字有四种操作,+1,-1,左交换,右交换(最左边的数字只有右交换
popcjz
·
2020-08-19 17:13
搜索
POJ
1195
Mobile phones 二维树状数组模板题
题意:给出一个全0的矩阵,然后一些操作0S:初始化矩阵,维数是S*S,值全为0,这个操作只有最开始出现一次1xyval:对于矩阵的X,Y坐标增加A2x1y1x2y2:询问(x1,y1)到(x2,y2)区间内值的总和3:结束对这个矩阵的操作思路:使用二维树状数组进行操作AC_code#include#include#include#include#include#include#include#in
flyzer
·
2020-08-19 09:29
树状数组
线段树
poj
1195
二维树状数组(单点更新)
题意:在一个矩阵中做一些add和query操作。二维树状数组裸题矩阵sum(x1,y1,x2,y2)=sum(0,0,x2,y2)-sum(0,0,x1-1,y2,)-sum(0,0,x2,y1-1)+sum(x1-1,y1-1);#include#include#include#include#definelsonl,mid,rt<<1#definersonmid+1,r,rt<<1|1usin
Sun_shiney
·
2020-08-19 08:24
线段树
树状数组模板+poj
1195
(二维树状数组)
感谢学长的博客~~http://blog.csdn.net/lin375691011/article/details/21247409在数组长度为n的树状数组中:寻找下一个需要添加的数的下标:intlowbit(intx){returnx&(-x);}一维树状数组更新是这样的:voidadd(intx,intval){for(;x0;x-=lowbit(x)){ans+=c[i];}returna
SDUTyangkun
·
2020-08-19 08:59
线段树
&&
RMQ
POJ(
1195
)(单点修改,区间查询)(二维)
题目大意给定一个N*N的网格,刚开始每个网格的值都是0,接下来会对这些网格进行操作,有一下两种操作:1、”XYA“对网格C[x][y]增加A2、”LBRT“查询所有(L2#include3#include4#include5#include6#defineN10577usingnamespacestd;89intn,k;10inta[N][N];1112intlowbit(intx)13{14re
weixin_30807677
·
2020-08-19 07:32
poj
1195
二维树状数组+单点修改区间查询
id=
1195
最后减的时候注意一下还要加上被多减的部分#includeusingnamespacestd;typedeflonglongll;constintN=1e3+100;constintINF=
yyyan_
·
2020-08-19 06:59
POJ
数据结构-树状数组
ZOJ
1195
..前面WA了好几次,发现数组不够啥的,还有一个问题。。。n=m=c=0时写错好几次。。。应该n&&m&&c就可以了!#include"stdio.h"intmain(){intn,m,c,i,j,k,q,sum,max;inta[20],b[20],d[20];q=0;while(scanf("%d%d%d",&n,&m,&c)&&n&&m&&c){q++;sum=0;max=0;for(i=1
LeonMakise
·
2020-08-18 13:14
ZOJ
poj
1195
(二维树状数组,点修改,区间求和)
题目链接:点击打开链接//题目大意:一个平面区间,修改某个点的numberofactivephones,区间求和#include#include#include#include#include#include#include#include#include#include#include#include#include#definen1500usingnamespacestd;intc[1500]
li49406
·
2020-08-18 09:06
poj
树状数组
gcc -ldl
http://hi.baidu.com/suinking/item/9275f705e9ab5068d45a
1195
gcc-O-otdstds.c-ldl-ldl选项,表示生成的对象模块需要使用共享库(
hlzs_01
·
2020-08-17 22:32
linux
Makefile
C - Basketball Exercise
https://codeforces.com/contest/
1195
/problem/C题解:一维线性dp,注意状态转移方程,0是取第一行,1是取第二行#include#include#include
只有魔法才能对抗魔法
·
2020-08-17 22:57
DP
Codeforces
1195
C-Basketball Exercise【dp】
题目链接题意给出两个数组,在这两个数组中取一些数使总和达到最大,取的规则是不能取相邻的数。思路dp开一个二维的dp数组,dp[2][100010],第一位0表示取第一行,1表示取第二行状态转移方程dp[0][i]=max(a[i]+dp[1][i-1],dp[0][i-1]);dp[1][i]=max(b[i]+dp[0][i-1],dp[1][i-1]);例如,取第一行的第i个数,那么上个数(i
arc3102
·
2020-08-17 03:56
Codeforces
1195
D1-Submarine in the Rybinsk Sea (easy edition)
题目链接题意就不讲了,挺容易理解的思路找规律看出来的,就这组样例来说3123345总共九种组合,分别是f(12,12)=1122f(12,33)=1323f(12,45)=1425f(33,12)=3132f(33,33)=3333f(33,45)=3435f(45,12)=4152f(45,33)=4353f(45,45)=4455就12来说,12的个位,也就是2在个位上贡献了3次在十位贡献了3
arc3102
·
2020-08-17 03:56
ACM/ICPC HDU
1195
2:“你”是有意识还是虚构只能由你自己证明这是我的某一篇论坛回复原题是hdu的
1195
;题目是英文的,大意我翻译一下。有一个紧急开启密码锁的任务。密码由四位数字组成;每个数字从1到9;每次
iteye_3452
·
2020-08-15 14:50
数据结构与算法
ZZUOJ-
1195
-OS Job Scheduling(郑州大学第七届ACM大学生程序设计竞赛E题)
1195
:OSJobSchedulingTimeLimit:2SecMemoryLimit:128MBSubmit:106Solved:35[Submit][Status][WebBoard]DescriptionOS
zzuspy
·
2020-08-15 11:31
各种训练
校省赛
简单题
hdu
1195
双向广搜
pid=
1195
代码比较长,但都是重复代码!!!#include#include#include#defineINF0x3f3f3f3f#defineBUGprintf("here!
JustSteps
·
2020-08-14 06:13
acm
搜索
1195
. 最小总代价
1195
.最小总代价题目描述n个人在做传递物品的游戏,编号为1-n。游戏规则是这样的:开始时物品可以在任意一人手上,他可把物品传递给其他人中的任意一位;下一个人可以传递给未接过物品的任意一人。
Code farmer—John
·
2020-08-13 13:20
模拟赛
动态规划
qt黑白棋
parent),ui(newUi::Maindow){ui->setupUi(this);//设置窗口信息this->setWindowTitle(“黑白棋”);this->setFixedSize(
1195
,1000
冰清花溢
·
2020-08-11 12:12
C++
qt
POJ-
1195
Mobile phones 二维线段树 区间求和
MobilephonesTimeLimit:5000MSMemoryLimit:65536KTotalSubmissions:9263Accepted:4154DescriptionSupposethatthefourthgenerationmobilephonebasestationsintheTampereareaoperateasfollows.Theareaisdividedintosqu
weixin_33991727
·
2020-08-10 23:07
poj
1195
二维线段树,区间求和,单点跟新
昨天搞了下二维线段树,今天来练练手~~感觉不错。二维线段树~我这里用的是树中有树的方法,建的二维线段树。也就是x坐标一棵树。然后每个对应x坐标的区间,又有一颗树为y坐标。理解了也就跟一维线段树差不多。#include#include#include#definelllonglong#definemaxn1025#defineinf0x3f3f3f3fllsum[maxn*4][maxn*4];ll
键盘上的艺术家w
·
2020-08-10 12:29
算法-线段树
cmake-3.6.2 FindBoost.cmake 错误
先说结论:
1195
行的if缺少右括号:if((GHSMULTIANDBoost_USE_STATIC_LIBS)OR(WIN32ANDBoost_USE_STATIC_LIBSANDNOTCYGWINANDNOTMSYS
redleaf0000
·
2020-08-10 00:56
技术文档
poj
1195
二维线段树(模板题)
二维线段树模板题:#include#include#include#include#includeusingnamespacestd;constintmaxx=1050;structnode{intl,r;intsum;};structnode1{intl,r;nodet[maxxmid)returnsquery(l,r,i*2+1,k);elsereturnsquery(l,mid,i*2,k)
殇峰
·
2020-08-09 09:13
POJ数据结构专辑(含部分题解)
1195
Mobilephones树状数组题解1455Crazyteaparty题解1521Entropyhuffman题解1703Findthem,Catchthem并查集1785BinarySearchHeapConstruction1794CastleWalls
deji2909
·
2020-08-09 07:33
ANSYS常见错误和警告
ansys警告和错误1、ThevalueofUYatnode
1195
is449810067.Itisgreaterthanthecurrentlimitof1000000.Thisgenerallyindicatesrigidbodymotionasaresultofanunconstrainedmodel.Verifythatyourmodelsiproperlyconstrained
originalsinQ
·
2020-08-08 11:22
ANSYS
poj
1195
(二维线段树||二维树状数组)
MobilephonesTimeLimit:5000MSMemoryLimit:65536KTotalSubmissions:17496Accepted:8089DescriptionSupposethatthefourthgenerationmobilephonebasestationsintheTampereareaoperateasfollows.Theareaisdividedintosq
ACLewis
·
2020-08-03 21:16
-----数据结构-----
树状数组
线段树
上一页
1
2
3
4
5
6
7
8
下一页
按字母分类:
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
其他