摘要:
求给出数的平均数,当然有些是不符合格式的,要输出该数不是合法的。 这里我写了函数来判断是否符合题目要求的数字,有点麻烦。 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> using name 阅读全文
posted @ 2017-02-11 22:53
辰曦~文若
阅读(945)
评论(0)
推荐(1)
摘要:
和下面是同类型的题目,只不过问的不一样罢了: 1090. Highest Price in Supply Chain (25)-dfs求层数 1106. Lowest Price in Supply Chain (25)-(dfs计算树的最小层数) #include <iostream> #incl 阅读全文
posted @ 2017-02-11 22:40
辰曦~文若
阅读(234)
评论(0)
推荐(0)
摘要:
先对学生们进行排序,并且求出对应排名。 对于每一个学生,按照志愿的顺序: 1.如果学校名额没满,那么便被该学校录取,并且另vis[s][app[i].ranks]=1,表示学校s录取了该排名位置的学生。 2.如果该学校名额已满,那么看看vis[s][app[i].ranks]是否为1,若是,则表明学 阅读全文
posted @ 2017-02-11 22:36
辰曦~文若
阅读(231)
评论(0)
推荐(0)
摘要:
题意就是给出9位以内的数字,按照汉子的读法读出来。 读法请看下方的几个例子: 5 0505 0505 伍亿零伍佰零伍万零伍佰零伍 5 5050 5050 伍亿伍仟零伍拾万伍仟零伍拾 (原本我以为这个是读:伍亿伍仟零伍拾万"零"伍仟零伍拾) 5 0550 0055 伍亿零伍佰伍拾万零伍拾伍 5 500 阅读全文
posted @ 2017-02-11 22:28
辰曦~文若
阅读(1087)
评论(0)
推荐(0)
摘要:
给定区间[L,R],给出在这区间之内的学生,并且按照他们的成绩非升序的顺序输出。 #include <iostream> #include <cstdio> #include <string.h> #include <algorithm> using namespace std; const int 阅读全文
posted @ 2017-02-11 22:23
辰曦~文若
阅读(274)
评论(0)
推荐(0)
摘要:
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm> using namespace std; const int maxn=90; char str1[maxn]; char str2[maxn 阅读全文
posted @ 2017-02-11 22:20
辰曦~文若
阅读(198)
评论(0)
推荐(0)
摘要:
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> using namespace std; const int maxn=100000+5; long lon 阅读全文
posted @ 2017-02-11 12:05
辰曦~文若
阅读(211)
评论(0)
推荐(0)
摘要:
题意:用栈的push、pop操作给出一棵二叉树的中序遍历顺序,求这棵二叉树的后序遍历。 需要一个堆结构s,一个child变量(表示该节点是其父亲节点的左孩子还是右孩子),父亲节点fa对于push v操作:1).第一个push肯定是根节点root。2).根据child变量,建立fa与v的父子关系。3) 阅读全文
posted @ 2017-02-11 11:34
辰曦~文若
阅读(1227)
评论(0)
推荐(0)
摘要:
判断插入排序很好判断,不是的话那就是归并排序了。 由于归并排序区间是2、4、8开始递增的,所以要判断给出的归并排序执行到哪一步,就要k从2开始枚举。 然后再对每个子区间进行一下sort即可。 #include <iostream> #include <cstdio> #include <algori 阅读全文
posted @ 2017-02-11 11:22
辰曦~文若
阅读(458)
评论(0)
推荐(0)
摘要:
给出一棵树,在树根出货物的价格为p,然后每往下一层,价格增加r%,求所有叶子节点中的最高价格,以及该层叶子结点个数。 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cm 阅读全文
posted @ 2017-02-11 11:09
辰曦~文若
阅读(316)
评论(0)
推荐(0)
摘要:
给出两个字符串,判断第二个字符串中的字符是否都出现在第一个中。 是,则输出Yes,以及多余的字符的个数。 否,则输出No,以及缺失的个数。 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> u 阅读全文
posted @ 2017-02-11 10:58
辰曦~文若
阅读(276)
评论(0)
推荐(0)