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
ans
LightOJ-1253 Misere Nim(Nim求解不正常的博弈)
代码:#includeusingnamespacestd;intt,n,x,
ans
,flag;intmain(){sca
薄层
·
2020-08-25 00:51
优秀算法总结
各种博弈
other
oj
HDOJ 1496 - Equations Hash
include6#include78/*将方程分划为2个部分,前一个部分最多有100*100种可能*/9#defineMAX300931011ints[10010]={0};12inta,b,c,d,
ans
yeweiouyang
·
2020-08-25 00:13
[ACM
ICPC]
洛谷p1226【模板】快速幂||取余运算
如chara=65;ausingnamespacestd;intmain(){longlongintb,p,k,
ans
=1;scanf("%lld%lld%lld",&b,&p,&k)
candicecyj
·
2020-08-25 00:52
ACM
九度OJ 题目1120:全排列
我们假设对于小写字母有’a’#includecharstr[10];boolmark[10];charans[10];voidoutput(){printf("%s\n",
ans
+1);}voidDFS
鲷哥fans
·
2020-08-25 00:17
考研机试
cf1208F Bits And Pieces
代码#includeusingnamespacestd;constint_=1e6+7;intn,
ans
,a[_],cnt[1=2)return;if(b==-1)
复杂的哈皮狗
·
2020-08-24 23:43
Gym - 102501B
include#defineIOSios::sync_with_stdio(false),cin.tie(0)usingnamespacestd;typedeflonglongLL;mapa;strings,
ans
小镇秋色
·
2020-08-24 23:10
HDU - 3294 Girls‘ research (马拉车,输出具体回文子串)
思路:先求出位移量来,把原串改变,然后跑一遍马拉车,得出长度
ans
。
林黛玉倒拔垂杨柳
·
2020-08-24 23:02
马拉车
HDU2683:完全数+组合数
includeusingnamespacestd;typedeflonglongll;chart;llx,y;vectorv;llpower(lla,lln){llans=1;while(n){if(n&1)
ans
月光下的魔术师
·
2020-08-24 23:19
数论
hdu3294 manacher算法
[pos]-2)/2-1;这个自己看一下就okay呐#include#include#includeusingnamespacestd;constintM=450000;intlen,id,p[M],
ans
weixin_34037977
·
2020-08-24 23:44
HDU1496
#include#includeconstintN=1000000;inthash[2*N+1],a,b,c,d,
ans
;intmain(){inti,j;while(scanf("%d%d%d%d",
LeeBooL
·
2020-08-24 23:46
HASH
【Tsinsen】A1393. Palisection 【Palindromic Tree】
然后我们再正着插入字符构造回文树,每次插入结束后,
ans
+=cnt2[i]*suffix[i+1]。当正着插入结束后,我们求得的
ans
恰
poursoul
·
2020-08-24 23:40
回文树【Palindromic
Tree】
hdu 2296 Ring(AC自动机+DP)
解题思路:AC自动机+DP,对得分串建立AC自动机,同样在自动机上DP,dp[i][j]表示长度i匹配到j节点的权值最大值,rec[i][j]则表示字典序最小的字符串,过程中既要维护
ans
。
JeraKrs
·
2020-08-24 23:12
HDU
GRADE:C
数据结构-AC自动机
2017.10.30 測試總結并今日總結
(27號是真的就不想寫了….)2017.10.30–Day22考前小總結:不吃飯真的不行啊…(餓)…做到T1胃虚了…(餓)…测试总结:T1:成功的被坑杀…前:inlinevoidCheck(){
Ans
=
Suzime
·
2020-08-24 23:45
測試總結
集训日记
c++
poj2155-二维线段树(树套树)
//先确定x线段树再确定y线段树#include#includeintn,
ans
,x1,x2,y1,y2;structnode{intl,r;structnode1{intl,r,s;}treey[4010
struct_liao
·
2020-08-24 23:30
AC自动机(应用)
intFind(char*s){intc;intnow=0,
ans
=0;while(*s){c=*s-'a';intk=now=ch[now][c];while(k){if(num[k]==0)break
Zery_
·
2020-08-24 23:06
ACM——字符串
P1226 【模板】快速幂||取余运算(C++_数论)
【数据范围】对于100%的数据,0≤b,p,k0){if(p&1)//二进制位该位是否为1
ans
*=b;//有就乘上b*=b;//自乘,时刻准备着p>
ccql
·
2020-08-24 22:01
算法
POJ 3276-Face The Right Way (开关问题)
#include#includeusingnamespacestd;constintmaxn=5005;intn,
ans
_k,
ans
_m=0x3f3f3f3f;intan[maxn];intff[maxn
Z.rush
·
2020-08-24 22:28
开关问题
Spreadsheet Tracking UVA - 512
typedeflonglongll;usingnamespacestd;constintmaxn=100;intr,c;//标记现在的矩阵大小intd[maxn][maxn],d2[maxn][maxn],
ans
qq_36424540
·
2020-08-24 22:18
紫书学习笔记
欧拉函数
欧拉函数φ(n)正常做法直接求#include#include#definelllonglongusingnamespacestd;lln,
ans
;intmain(){cin>>n;
ans
=n;for(
almz654321
·
2020-08-24 22:16
C++编程
鬼欧拉
蛋疼度度熊
然后开一个队列,从前往后压入队列,如果出现了断开的部分,就用m比较,如果小于m,就把m减去这一段的长度,然后压入队列,如果大于m,就弹出队首元素,增加m,直到这一段的长度小于m进行更新,在这期间,要不断的进行更新
ans
almz654321
·
2020-08-24 22:14
C++编程
黑恶势力
HDU-2157 How many ways??
#include#includeusingnamespacestd;constintN=1e2;constintmod=1e3;structabc{intt[N][N];}a,
ans
,tmp;voidinit1
qq_25243147
·
2020-08-24 22:10
数论
HDU-5536 Chip Factory
不用字典树,暴力也可以解决#include#include#includeusingnamespacestd;constintN=1e6+5;inttot,trie[N][2],n,a[1005],
ans
qq_25243147
·
2020-08-24 22:10
字典树
POJ-3974 Palindrome
include#include#includeusingnamespacestd;constintN=1e6+5;constintNN=2e6+5;chars[N],ss[NN];intp[NN],len,
ans
qq_25243147
·
2020-08-24 22:09
Manacher
HDU-4513 (马拉车)
在原模板求p时加入条件保证从左到中心递增#include#includeusingnamespacestd;constintN=1e6+5;ints[N],p[N],ss[N],len,
ans
;voidManacher
qq_25243147
·
2020-08-24 22:09
Manacher
单词查找之Trie树
输出:对于每一个询问,输出一个整数
Ans
,表示词典中以小Hi给
李永昌
·
2020-08-24 22:03
数据结构与算法分析
[旧文章补档]数学相关
#快速幂#intqpow(intx,intk,intp){intans=1;for(;k;x=x*x%p,k=k>>1)if(k&1)
ans
=(
ans
*x)%p;returnans;}#线性筛#voidget_prime
jrljn
·
2020-08-24 22:28
树状数组
www.cnblogs.com/hsd-/p/6139376.htmlintlowbit(intt){returnt&(-t);}voidadd(intx,inty){for(inti=x;i0;i-=lowbit(i))
ans
多鏃
·
2020-08-24 22:49
树状数组
POJ2155 二维线段树
二维线段树,不像hdu1823用4分搞定,这题4分会超时,用树套树即可#include#includeboolseg[4010][4010];intn,m,T,
ans
;voidudy(inti,intl
nash142857
·
2020-08-24 22:49
线段树
矩阵的n次幂(转)
longlongintmod=1e9+7;intn;structasd结构体貌似没太大用{longlonginta[102][102];};asdmul(asdx,asdy)x和y的矩阵相乘{asdans;memset(
ans
.a
多鏃
·
2020-08-24 22:17
矩阵加减乘
基础没太懂
hdu1496 Equations(hash表)
解题思路:hash+优化1、如果a、b、c、d全正或全负则直接输出02、由于解的区间是对称的,所以我们只需要枚举1~100之间的就可以了,结果
ans
*16即可3、判断某个数是否存在此处用到了hash表处理代码
Think_Idea
·
2020-08-24 22:06
hash
hdu 3294 Girls' research
b:a;}intmain(){inti,id,mx,max,n,j,
ans
,m;while(scanf("%s
lihaogegehuting
·
2020-08-24 22:47
HDU
poj
manacher
manacher
HDOJ 4512 - 吉哥系列故事——完美队形I
include#include#include#include#definelllonglong#defineoo1000000000usingnamespacestd;inth[205],n,dp[205],
ans
kk303
·
2020-08-24 22:26
动态规划
洛谷P1379_八数码游戏
0,1,0,-1};intdc[4]={-1,0,1,0};intbfs();boolcanmoveto(intu,intdir);intmoveto(intu,intdir);intmain(){intn,
ans
CoderCat.
·
2020-08-24 22:31
搜索
poj 1816
wa了几次,错在了判重上*j*jjjj应该是4但是由于*的存在,find递归是我的结果
ans
队列中应该有两个是4;所以输出时判断一下是否与前一个一样;#include#include#include#include
iwillsucceed555
·
2020-08-24 22:59
acm---字符串
UVa512 Spreadsheet Tracking
第一种,无脑模拟#include#include#definemaxd100#defineBIG10000intr,c,n,d[maxd][maxd],d2[maxd][maxd],
ans
[maxd][
virtu41
·
2020-08-24 22:44
算法竞赛入门经典第二版
c语言
算法
CodeFoeces-864B
;intmain(){intl;strings;setst;cin>>l>>s;intans=0;for(inti=0;i='a'&&s[i]<='z'){st.insert(s[i]);}else{
ans
ss5smi
·
2020-08-24 22:03
SCL--二分与lower_bound / upper_bound
lower_bound:intl=1,r=n,
ans
;while(l
ans=l;upper_bound
dingdi3021
·
2020-08-24 21:41
线段树套线段树 -转自CSDN博客nash142857 -POJ2155
#include#includeboolseg[4010][4010];intn,m,T,
ans
;voidudy(inti,intl,intr,intj,inty1,inty2){if(l==y1&&r
cnyali
·
2020-08-24 21:19
算法分享
程序代码
树形DP poj1741
,问两个点之间的dist(u,v)#include#include#include#includeusingnamespacestd;constintmaxn=1e5+10,inf=1e9;intk,
ans
as604412059
·
2020-08-24 21:45
树形dp
HDU 2825 Wireless Password (AC自动机 + 状压dp)
题意:给你m(m#include#include#includeusingnamespacestd;constintmod=20090717;voidadd(int&
ans
,intx){
ans
+=x;if
aozil_yang
·
2020-08-24 21:44
DP
HDU
AC自动机
字符串-字符串哈希-入门-bzoj2084
#include#definerep(i,l,r)for(inti=(l);i=(l);i--)usingnamespacestd;intn,
ans
TengWan_Alunl
·
2020-08-24 21:59
字符串-字符串哈希
树套树之线段树套线段树(POJ2155 Matrix)
开始时,A[i,j]均为0(1#includeboolg[4010][4010];intn,m,T,
ans
;voidupdate_y(inti,intl,intr,intj,inty1,inty2)
Sunshine_cfbsl
·
2020-08-24 21:26
树套树
树
POJ
kuangbin专题十七 HDU3065 AC自动机
题解:AC模板题,这道模板题在里面加个数组
ans
表示病毒的数量就可以了。
Start_to_crazy
·
2020-08-24 21:54
AC自动机
P1164 小A点菜(两种解法dfs+剪枝/dp)
voiddfs(intmoney,intindex){if(money==mon){
ans
++;return
Spidy_harker
·
2020-08-24 21:53
dfs
动态规划(dp)
Gym 102152 problem K Subarrays OR
以当遍历到a[i]时,得到[1,i-1],[2,i-1],[3,i-1]……的值,并分别与a[i]取或插入答案数组
ans
中。
S atur
·
2020-08-24 21:21
比赛&训练
【[HNOI2002]彩票】
刚开始想用动态规划,但是这是实数于是泡汤,最后看数据不是很大,于是采用搜索加上剪枝代码#include#include#include#includeusingnamespacestd;intn,m,
ans
Shikita
·
2020-08-24 21:50
洛谷博客
哈希函数--字符串哈希--hdu1800 Flying to the Mars
,下列hash函数的效率平均为0.67-0.69,3000/7003=0.43,hash值数组开得稍大比较合适//2.7003看起来像素数,适合取余intcnt[N],hashnum[N];intn,
ans
Falling~
·
2020-08-24 21:17
数论
BZOJ 1224 HNOI2002 彩票 DFS
左右所以考虑加剪枝上下界剪枝如果当前的情况下剩余的数最大都无法到达目标或最小都无法小于目标则剪枝#include#include#include#include#include#defineM60#defineEPS1e-10usingnamespacestd;intn,m,
ans
PoPoQQQ
·
2020-08-24 21:11
BZOJ
DFS
UVA - 512 Spreadsheet Tracking
include#include#definemaxd100#defineBIG10000usingnamespacestd;intr,c,n,d[maxd][maxd],d2[maxd][maxd],
ans
MrFox_
·
2020-08-24 21:05
【模板】字符串哈希
constintmaxn=1e6+10;constintbase=131;chars1[maxn],s2[maxn];unsignedlonglongpower[maxn],tot,h[maxn],l1,l2,
ans
K1385170
·
2020-08-24 21:21
上一页
62
63
64
65
66
67
68
69
下一页
按字母分类:
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
其他