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
[BZOJ 1005] 明明的烦恼 && [BZOJ 1211] 树的计数【组合数学】
注意特判n=1的情况,if(degree[1]=0)
ans
=1,elseans=0;然后就可以愉
Codeplay0314
·
2020-08-23 07:18
组合数学
BZOJ
[Codeforces Round #310 (Div. 2)] #ABC题解
[
Ans
]n-2*(min(num0.num1))[Code
Codeplay0314
·
2020-08-23 07:47
codeforces
A + B Problem II (大数加模拟,,坑点在格式错误)
B.InputThefirstlineoftheinputcontainsanintegerT(1#include#includeusingnamespacestd;inta[1005],b[1005],
ans
qdu_zhaiH
·
2020-08-23 07:42
日常刷题
模板
OJ 1146 【搜索基础】有重复元素的排列问题
这n个元素由小写字母组成,这n个元素中的某些可能相同[输入格式]1usingnamespacestd;inta[505]={0},
ans
[27],T;intcont={0};voiddfs(intss)
云淡风轻(→o←)
·
2020-08-23 07:05
OJ
CCF18-122
includeusingnamespacestd;#defineLLlonglongintmain(){intn;LLr,g,y;cin>>r>>y>>g>>n;LLans=0;for(inti=0;i>k>>t;if(k==0)
ans
大梦小半
·
2020-08-23 07:19
CCF
NOJ:危险的组合
#include#include#includeintmain(){intn;scanf("%d",&n);inti,t,
ans
=0;for(i=1;i<=(n-2);i++)//第一个三连的位置{t=
学长很忙
·
2020-08-23 07:38
NOJ
BZOJ 1631: [Usaco2007 Feb]Cow Party【最短路】
代码如下#include#include#include#include#includeusingnamespacestd;intn,m,X,dst[2][100005],
Ans
;intlnk[2][100005
XSamsara
·
2020-08-23 07:28
BZOJ
最短路
[洛谷1129] [ZJOI2007]矩阵游戏 {匈牙利算法}
代码#include#include#include#include#definerrregisterusingnamespacestd;intT,n,f[501][501],link[501],
ans
心有猛虎|细嗅蔷薇
·
2020-08-23 06:10
匈牙利算法(二分图最大匹配)
【动态规划】[luoguP1868]饥饿的奶牛
题目一开始又没用读懂题DP题dp[i]表示牛走到i这个位置能吃到的最大草数最后
ans
找最大值关键找最右的端点然后从0一直找过去(为什么从0找我也不知道一开始从1找wa了一个大点从0找就ac了)代码如下#
ars4me
·
2020-08-23 06:02
动态规划
有重复元素的全排列
#include#include#includeusingnamespacestd;chara[11],
ans
[11];intvis[11],sum,num[11];boolcheck(intx,intlen
Freopen
·
2020-08-23 06:29
模板
数论
【bzoj1724】[Usaco2006 Nov]Fence Repair切割木板
#include#includelonglongn,
ans
=0;usingnamespacestd;intmain(){priority_queue,greater>q;scanf("%lld",&n)
ndsffx501ccy
·
2020-08-23 06:51
数据结构
【bzoj 1609】麻烦的聚餐
include#include#include#include#include#includeusingnamespacestd;inta[30005],b[30005];intf[30005][4];intn,
ans
_ldxxx_
·
2020-08-23 06:28
bzoj
神奇乱搞
动态规划
C/C++随机生成[0,N-1]的序列
C/C++随机生成[0,N-1]的序列用C/C++实现MATLAB中的randperm函数1、MATLAB中的randperm函数如下:>>randperm(20)
ans
=13921711531918101714201561641282
jnulzl
·
2020-08-23 06:28
C/C++
【DP】饥饿的牛
饲料槽依次用1到N(1j;ifibthenexit(a);exit(b);end;proceduremain;vari,j:longint;
ans
:longint;beginreadln(b);fori
jie_guale
·
2020-08-23 06:21
NOIP2011黎明前夕的黑暗
动态规划
Matlab中的向量的运算
1、向量与数的加法>>a=linspace(1,100,10)a=11223344556677889100>>a+100
ans
=1011121231341451561671781892002、向量与数的减法
iteye_8264
·
2020-08-23 06:09
BZOJ 4936: [Ceoi2016]match
100002,mod0=1e9+7,mod1=998244353;charB[1'9'){if(ch=='-')f=-1;ch=gc;}while(ch>='0'&&chp[26];chars[N],
ans
cgh_Andy
·
2020-08-23 05:42
bzoj
哈希
一般图极大团个数,最大团顶点数
includeusingnamespacestd;constintmaxn=130;boolmp[maxn][maxn];intsome[maxn][maxn],none[maxn][maxn],all[maxn][maxn];intn,m,
ans
baichuan9723
·
2020-08-23 05:08
hdu 5745 La Vie en rose 2016多校第二场1012
题意:串s串p,挑出p中k个不相邻的位置,都与右边的交换,算产生一个串看sisi+1...si+m−1如果是产生的其中一个串,
ans
[i]=1,否则
ans
[i]=0;官方题解:O(N*M)暴力的:枚举左端点
MQLYES
·
2020-08-23 05:44
2016多校联赛
[题解] Obstacle Course C++
DescriptionInputOutputSampleInputSampleOutput思路~~大麻~~代码题目Description考虑一个NxN(1usingnamespacestd;intn,
ans
The_yja_of_Oier
·
2020-08-23 05:43
有重复数字的不重复全排列
这三个数只有3种全排列分别为1121212111\1\2\\1\2\1\\2\1\1112121211Solution\mathcal{Solution}Solution设第iii个数有aia_iai个
ans
Morning_Glory_JR
·
2020-08-23 05:59
实用
数论
竞赛算法
bzoj1609 [Usaco2008 Feb]Eating Together麻烦的聚餐(dp)
O(n)#include#include#defineN30005intn,a[N],dp[N][4],
ans
=0;inlineintmin(intx,inty){returnx=1;--i){dp[i
Icefox_zhx
·
2020-08-23 04:00
bzoj
[BZOJ4325][NOIP2015]斗地主(dfs)
代码#include#include#includeusingnamespacestd;intT,n,x,y,
ans
;inta[20];voidclear(){memset(a,0,sizeof(a))
Clove_unique
·
2020-08-23 04:39
题解
搜索
NOIP
快速乘(模板)
但是写高精度又太麻烦的情况代码#include#definelllonglongusingnamespacestd;inlinellksc(lla,llb,llmod){llans=0;while(b>0){if(b&1)
ans
BIGBIGPPT
·
2020-08-23 04:32
分治
快速乘
【BZOJ 4973】比特战争(kruskal思想)
对于不属于一个联通块的x,y,现在想要联通他们则
ans
[y]=min(
ans
[x]+
ans
[y],max(edge[i].val,max(maxa[x],maxa[y]))*min(minb[x],minb
Android66666
·
2020-08-23 04:28
bzoj1669 [Usaco2006 Oct]Hungry Cows饥饿的奶牛
DescriptionFarmerJohn养了N(1#defineN10010#defineinf100000000intn,
ans
;inta[N];intmn[N];inlineintread(){intx
weixin_30416871
·
2020-08-23 04:42
简单的堆与优先队列问题
为此,他需要N(1usingnamespacestd;priority_queue,greater>q;longlongn,sum,
ans
,a,b;intmain(){freopen("plank.in
lummerx
·
2020-08-23 04:57
c++
队列
【USACO 2006 November Gold】Corn Fields
【题目链接】点击打开链接【算法】状压DP【代码】#includeusingnamespacestd;#defineMAXN12#defineMOD100000000intM,N,i,j,k,
ans
,state
even_bao
·
2020-08-23 04:27
动态规划
BZOJ1669: [Usaco2006 Oct]Hungry Cows饥饿的奶牛
#include#include#include#includeusingnamespacestd;intn,a[5001],last[5001],
ans
;intmain(){memset(last,127
小火小火车车车
·
2020-08-23 04:22
有重复元素的全排列
标题:有重复元素的全排列题目描述:Description输入n(#include#includeusingnamespacestd;chars[20],s1[20];inta[27],l,
ans
=0;voidsearch
degenerates—こんにゃく
·
2020-08-23 04:20
排列组合
计数问题
有n个格子从左到右排成一行,有m种颜色,每个格子涂一种颜色,求n个格子恰好涂了k种颜色的方案数
ans
。答案对某个常用质数取模。输入一行空格隔开的三个整数n,m,k。输出一行一个整数
ans
。
AWESOME_CDX
·
2020-08-23 04:59
[BZOJ1724][Usaco2006 Nov]Fence Repair 切割木板
为此,他需要N(1maxlongint)or(y[tt*2+1]1dobeginj:=y[1];y[1]:=maxlongint;shai(1,1);dec(y[0]);k:=y[1];inc(
ans
,
slongle_amazing
·
2020-08-23 04:20
基础算法—贪心
数据结构—堆
NOIP十连测 涂色游戏
那么显然可以得到dp[i][k]=dp[i-1][j]*
ans
[j][k]。其中
ans
[j][k]
zzk_233
·
2020-08-23 04:00
构造
dp
矩阵乘法
NOIP2015 过河 【递推(dp)+离散化】
f[i-j]+map[i]|s#include#include#includeusingnamespacestd;constintM=110,N=2520,L=N*M;intl,s,t,m,a[M],
ans
zerollt
·
2020-08-23 04:29
dp
NOIP系列
★ POJ 2516 最小费用最大流(分开计算,K次费用流)
代码1://O(Kn^2m)//如果要求最大费用的话只需在加边的时候加-的边输出时输出-
ans
即可#pragmacomment(linker,"/STACK:102400
Go__boy
·
2020-08-23 04:27
网络流
网络流
POJ-3579-Median
代码:#include#include#include#includeusingnamespacestd;constintmaxn=1e5+1000;inta[maxn],n,m,
ans
;booltest
南宮逸辰
·
2020-08-23 04:55
POJ
ACM
洛谷P1031 均分纸牌
#include#include#include#include#include#include#includeusingnamespacestd;intn,a[10001],average,sum,
ans
wr0831
·
2020-08-23 03:21
贪心算法
NOIp提高组单词接龙(T3)————深搜,字符串
代码如下:#includeusingnamespacestd;intn,dic[21][21],vis[21],
ans
;stringwords[21];chars;voidf(stringa,stringb
wly127
·
2020-08-23 03:47
搜索
洛谷 P1019 单词接龙
includeusingnamespacestd;intn;stringa[25];//string类的数组intb[25];//单词出现的次数intans,nom=1;//长度voiddfs(intx){
ans
晴天雨是谁
·
2020-08-23 03:15
过河(状压dp
TLEintl,s,t,m;mapdp,mp;//intdp[maxn],mp[maxn];intmain(){l=ird();s=ird();t=ird();m=ird();for(inti=1;i=l)
ans
shawww_08
·
2020-08-23 03:25
DP
过河(dp+路径压缩)
include#include#include#include#includeusingnamespacestd;typedeflonglongll;constintN=1e6+10;intn,m,t,s,l,
ans
THE END GAME
·
2020-08-23 03:05
洛谷
DP动态规划
4333: 单词接龙
#includeusingnamespacestd;intn,
ans
,vis[20];strings[20];intlinklen(strings1,strings2){//最小可连接长度for(inti
noon/moon
·
2020-08-23 03:38
寒假马拉松
洛谷 P3317 [SDOI2014]重建(矩阵树定理+数学推导) [bzoj3534]
首先我们来看答案应该是怎样的:
ans
=∑Tree∏(u,v)∈EP(u,v)∏(u,v)∉E(1−P(u,v))然后我们来想一下怎么来构造这个答案:首先,我们直接矩阵树用高斯算出来的结果应该是这个:now
weixin_34409822
·
2020-08-23 03:32
BZOJ3659 : Which Dreamed It
$
ans
=以1为起点的欧拉回路个数\times1的度数$。高斯消元即可,时间复杂度$O(n
weixin_34221112
·
2020-08-23 03:21
【NOIP】普及组2010 三国游戏
include#include#include#include#includeusingnamespacestd;constintmaxn=510;inta[maxn][maxn],n,max1,max2,
ans
weixin_33809981
·
2020-08-23 03:59
洛谷 1019 单词接龙
【代码】#include#include#include#defineLLlonglong#definergregister#defineN1010usingnamespacestd;intn,
ans
,
weixin_30737433
·
2020-08-23 03:40
NOIp2005 过河【dp+离散化】By cellur925
转移方程也很明了,为$f[i]$=$min${$f[i-j]$),,这个位置有石子时答案再加1,$s2#include3#include45usingnamespacestd;67intl,s,t,m,
ans
weixin_30723433
·
2020-08-23 03:39
矩阵乘法优化dp
两矩阵相乘则得C矩阵为m*n;for(inti=1;i#includeusingnamespacestd;constintP=1e9+7;structs{longlonga[101][101];}A,
ans
weixin_30698527
·
2020-08-23 03:07
cf280C. Game on Tree(期望线性性)
题意题目链接Sol开始想的dp,发现根本不能转移(貌似只能做链)根据期望的线性性,其中\(
ans
=\sum_{1*f(x)}\)\(f(x)\)表示删除\(x\)节点的概率,显然\(x\)节点要被删除,
weixin_30677475
·
2020-08-23 03:06
深搜的剪枝技巧
首先是深搜的模板:intans=最坏情况,now;//now为当前答案voiddfs(传入数值){if(到达目的地)
ans
=从当前解与已有解中选最优;for(遍历所有可能性)if(可行){进行操作;dfs
weixin_30415801
·
2020-08-23 03:19
2019 HDOJ Multi-University Training Contest Stage 1(杭电多校)
include4#include56usingnamespacestd;78typedeflonglongll;910typedefpairpiir;1112constintN=100+5;1314intn,m,
ans
weixin_30315435
·
2020-08-23 03:42
上一页
66
67
68
69
70
71
72
73
下一页
按字母分类:
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
其他