上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 58 下一页
摘要: 已知前序遍历序列和中序遍历序列,可以唯一确定一棵二叉树。 已知后序遍历序列和中序遍历序列,可以唯一确定一棵二叉树。 但是已知前序遍历序列和后序遍历序列,是不能确定一棵二叉树的。 下面例子通过前序遍历和中序遍历确定唯一的一棵二叉树。 前序遍历:EACBDGF 中序遍历:ABCDEFG 1、首先根据前序 阅读全文
posted @ 2019-11-28 16:02 知道了呀~ 阅读(6355) 评论(0) 推荐(1) 编辑
摘要: F: Horse Pro 豆豆也已经开始学着玩象棋了,现在豆豆已经搞清楚马的走法了,但是豆豆不能确定能否在 100 步以内从一个点到达另一个点(假设棋盘无限大)。 Input 第一行输入两个整数 x1,y1 表示当前马所在的位置。 第二行输入两个整数 x2,y2 表示豆豆想把马走在的位置。 −100 阅读全文
posted @ 2019-11-25 21:53 知道了呀~ 阅读(388) 评论(0) 推荐(0) 编辑
摘要: B: 最小代价 题解:先用最小生成树求联通所有点的最小代价ans 在求度为1的时候权值最大的点mx ans-mx就是答案 #include<iostream> #include<algorithm> #include<vector> #include<math.h> #define ll long 阅读全文
posted @ 2019-11-25 16:05 知道了呀~ 阅读(418) 评论(0) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/contest/1168/C来源:牛客网 题目描述 已知了飞行器的起点和终点以及n个休息站的坐标,问起点到终点的最短路径是多少? 限制:飞行器不能长期飞行,必须中途在某结点下停下休息。(即连续飞行距离应不大于m) 欧涛师兄很想在师妹面前大 阅读全文
posted @ 2019-11-24 21:03 知道了呀~ 阅读(390) 评论(0) 推荐(0) 编辑
摘要: B: Prime Split 题解: 1、先判断两个素数w[i]、w[j]的和是否大于n-2,若小于则说明数字n不可能由三个素数组成(2是最小的素数) 2、再判断n-w[i]-w[j]是否是素数 3、保证w[i]、w[j]、n-w[i]-w[j]是递增的,避免重复计数 //注意laz[]要和线段树数 阅读全文
posted @ 2019-11-24 20:46 知道了呀~ 阅读(589) 评论(0) 推荐(0) 编辑
摘要: F: 操作数 题解:和刷气球那题一样,判断每个位置被更新的次数,如果是奇数输出1,偶数输出0 注意:用cin会超时 一、线段树 //注意laz[]要和线段树数组开一样大小 #include<iostream> #include<algorithm> #include<vector> #include 阅读全文
posted @ 2019-11-24 20:20 知道了呀~ 阅读(824) 评论(0) 推荐(0) 编辑
摘要: C. Swap Letters time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Monocarp has got two str 阅读全文
posted @ 2019-11-23 21:01 知道了呀~ 阅读(1299) 评论(0) 推荐(0) 编辑
摘要: W - Prime Time 题意:用公式n*n+n+41,判断素数的百分比 #include<iostream> #include<algorithm> #include<math.h> #include<string.h> #include<string> #define ll long lon 阅读全文
posted @ 2019-11-15 15:11 知道了呀~ 阅读(365) 评论(0) 推荐(0) 编辑
摘要: A - Bi-shoe and Phi-shoe Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He n 阅读全文
posted @ 2019-11-14 11:28 知道了呀~ 阅读(209) 评论(0) 推荐(0) 编辑
摘要: D. Treasure Island time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output All of us love treasur 阅读全文
posted @ 2019-11-12 18:47 知道了呀~ 阅读(300) 评论(0) 推荐(1) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 58 下一页