码迷,mamicode.com
首页 >  
搜索关键字:swap nodes in pairs    ( 8848个结果
「BJOI2018」求和
「BJOI2018」求和 "传送门" 观察到 $k$ 很小而且模数不会变,所以我们直接预处理 $k$ 取所有值时树上前缀答案,查询的时候差分一下即可。 参考代码: ...
分类:其他好文   时间:2020-01-24 00:17:51    阅读次数:74
刷题2. Add Two Numbers
一、题目要求 You are given two non empty linked lists representing two non negative integers. The digits are stored in reverse order and each of their nodes ...
分类:其他好文   时间:2020-01-23 12:26:54    阅读次数:77
PAT Advanced 1043 Is It a Binary Search Tree (25分)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes ...
分类:其他好文   时间:2020-01-23 09:27:17    阅读次数:80
题解 CF613D 【Kingdom and its Cities】
考虑树形$DP$,设$num_x$记录的为当$1$为根时,以$x$为子树中重要城市的个数。 那么进行分类讨论: ① 当$num_x≠0$时,则需将其所有满足$num_y≠0$的儿子$y$删去。 ② 当$num_x=0$时,若满足$num_y≠0$的儿子$y$个数$cnt=1$,则直接让$num$进行 ...
分类:其他好文   时间:2020-01-22 23:43:05    阅读次数:83
[LeetCode] 928. Minimize Malware Spread II 最大程度上减少恶意软件的传播之二
(This problem is the same as Minimize Malware Spread , with the differences bolded.) In a network of nodes, each node is directly connected to another ...
分类:其他好文   时间:2020-01-22 14:25:47    阅读次数:117
POJ 2187 Beauty Contest
题意: "题目链接" 给定 $n$ 个点,求距离最远的两个点之间的距离,输出最远距离的平方 $n include using namespace std; const int N=50005; int n,top,per[N],res; struct point{int x,y;int dist() ...
分类:其他好文   时间:2020-01-22 13:15:14    阅读次数:58
c语言堆排序的实现
堆排序的实现如下,用法与qsort相似: static void swap(void* a, void* b, int size) { char t; do { t = *(char*)a; *(char*)a++ = *(char*)b; *(char*)b++ = t; } while (--s ...
分类:编程语言   时间:2020-01-22 12:42:56    阅读次数:80
1325. Delete Leaves With a Given Value
Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target,  ...
分类:其他好文   时间:2020-01-22 11:06:54    阅读次数:64
[Leetcode]646.Maximum Length of Pair Chain
链接: "LeetCode646" 给出?n?个数对。?在每一个数对中,第一个数字总是比第二个数字小。 现在,我们定义一种跟随关系,当且仅当?b [3,4]$ 相关标签: 动态规划 很明显这道题能通过动态规划解,令dp[i]表示为以索引i为结尾的最长数对链的长度,则当$pairs[i][0] pai ...
分类:其他好文   时间:2020-01-22 10:49:52    阅读次数:75
linux-深度学习环境配置-Centos
下载Centos 7安装镜像,制作启动优盘。Install CentOS 7 安装CentOS 7。第一步,配置日期、语言和键盘。第二步,选择-系统-安装位置,进入磁盘分区界面。选择-其它存储选项-分区-我要配置分区,点左上角的“完成”,进入下面的界面:1234# swap #交换分区,一般设置为内... ...
分类:系统相关   时间:2020-01-21 23:15:58    阅读次数:235
8848条   上一页 1 ... 65 66 67 68 69 ... 885 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!