码迷,mamicode.com
首页 >  
搜索关键字:algorithm    ( 11758个结果)
Codeforces Round #594 (Div. 2) C. Ivan the Fool and the Probability Theory
题目原址:C. Ivan the Fool and the Probability Theory 题意:n×m的网格中填黑白格,最多有两个相邻,共用一条边为相邻,有几种填法。 思路:这题比赛写自闭了,一直觉得自己的思路没错,然后就残酷打脸,超级难受的那种。 从不能有3个及以上相邻可以得出,只要有两个 ...
分类:其他好文   时间:2019-10-21 20:54:48    阅读次数:91
190819-Hallro-最短路/dp
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<string> 5 #include<cstring> 6 #include<algorithm> 7 using namespace std; 8 namesp ...
分类:其他好文   时间:2019-10-20 19:35:20    阅读次数:117
树链剖分 HYSBZ - 1036
```cpp include include include include include include include include include include include // include include define up(i,a,b) for(int i=a;ib;i ) ...
分类:其他好文   时间:2019-10-20 13:00:59    阅读次数:58
混合背包问题
题目:https://www.acwing.com/problem/content/7/ 混合背包是一个比较简单的问题,也就是物品中既有01背包,又有完全背包,还有多重背包,这个时候的多重背包一般使用二进制拆分成01背包来做,因为用单调队列优化的话需要保证初始条件一样,也就是得先读入所有的物品,然后 ...
分类:其他好文   时间:2019-10-20 12:49:17    阅读次数:82
分组背包+二维费用背包
题目:https://www.acwing.com/problem/ 分组背包问题描述是共有n组物品,每组物品你只能选一个,求最大价值 二位费用背包也是个比较简单的问题,主要就是将01背包中的体积换为重量和体积两个参数 ...
分类:其他好文   时间:2019-10-20 12:41:00    阅读次数:77
51Nod1103 N的倍数
Problem 一个长度为N的数组A,从A中选出若干个数,使得这些数的和是N的倍数。 例如:N = 8,数组A包括:2 5 6 3 18 7 11 19,可以选2 6,因为2 + 6 = 8,是8的倍数。 Solution 前缀和取模,相同的都行,注意下标0。 Code include includ ...
分类:其他好文   时间:2019-10-19 18:58:43    阅读次数:89
生成树计数 lighting 最终决定用这个模板!
1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <cmath> 5 #define sqr(x) ((x)*(x)) 6 using namespace std; 7 const int M=100... ...
分类:其他好文   时间:2019-10-19 14:38:36    阅读次数:71
260. Single Number III
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements ...
分类:其他好文   时间:2019-10-19 10:06:25    阅读次数:108
187. Repeated DNA Sequences
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to ...
分类:其他好文   时间:2019-10-19 10:02:26    阅读次数:79
关于最小生成树
[TOC] 最小生成树 $By:Soroak$ 定义:一个有 $n$ 个结点的连通图的生成树是原图的极小连通子图,且包含原图中的所有 $n$ 个结点,并且有保持图连通的最少的边。最小生成树可以用 $kruskal$ 算法或 $Prim$ 算法求出。 Kruskal 定义: $Kruskal$ 是基于 ...
分类:其他好文   时间:2019-10-18 21:51:33    阅读次数:97
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!