摘要: 根据中序遍历和前序遍历确定一棵二叉树,然后按“层次遍历”序列输出。输出规则:除根节点外,接下来每层的节点输出顺序是:先从左到右,再从右到左,交替输出 #include <iostream> #include <cstdio> #include <algorithm> #include <string 阅读全文
posted @ 2017-03-05 20:07 辰曦~文若 阅读(999) 评论(0) 推荐(0)
摘要: 题目已经告诉如何判断欧拉回路了,剩下的有一点要注意,可能图本身并不连通。 所以这里用并查集来判断图的联通性。 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <string 阅读全文
posted @ 2017-03-05 20:03 辰曦~文若 阅读(639) 评论(0) 推荐(0)
摘要: 贪心水题,每次取最短的两个绳子合并,长度缩减成一半 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <string> #include <map> using namesp 阅读全文
posted @ 2017-03-05 19:45 辰曦~文若 阅读(250) 评论(0) 推荐(0)
摘要: 水题一个,贴个代码吧。 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <string> #include <map> using namespace std; const 阅读全文
posted @ 2017-03-05 19:40 辰曦~文若 阅读(269) 评论(0) 推荐(0)
摘要: 又是一道字符串处理的题目。。。 题意:给出两个浮点数,询问它们保留n位小数的科学计数法(0.xxx*10^x)是否相等。根据是和否输出相应答案。 思路:先分别将两个浮点数转换成相应的科学计数法的格式1.point为小数点的索引,初始化为字符串的长度len2.not0位第一个非0的数字的索引,初始化为 阅读全文
posted @ 2017-03-05 12:06 辰曦~文若 阅读(298) 评论(0) 推荐(1)