上一页 1 2 3 4 5 6 7 8 9 ··· 30 下一页
摘要: #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> #include <queue> using namespace std; int color[3]; ch 阅读全文
posted @ 2017-04-19 19:56 辰曦~文若 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 排序,求整体的排名和局部的排名整体排序,for循环一遍同时存储整体目前的排名和所在局部的排名即可 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> #incl 阅读全文
posted @ 2017-04-19 19:55 辰曦~文若 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 大数据加法给一个数num和最大迭代数k每次num=num+num的倒序,判断此时的num是否是回文数字,是则输出此时的数字和迭代次数如果k次结束还没找到回文数字,输出此时的数字和k 如果num一开始是回文数字,那么直接输出num和0即可。 #include <iostream> #include < 阅读全文
posted @ 2017-04-19 19:53 辰曦~文若 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 和1024一样都是大数据的题,因为位数最多要20位,long long最多19位给一个num,求sum=num+num问sum包含的数字,是否是num的一个排列,即数字都一样,只是顺序不同罢了。 #include <iostream> #include <cstdio> #include <algo 阅读全文
posted @ 2017-04-19 19:52 辰曦~文若 阅读(279) 评论(0) 推荐(0) 编辑
摘要: dfs求最大层数并查集求连通个数 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <string> #include <vector> using namespace st 阅读全文
posted @ 2017-04-18 15:31 辰曦~文若 阅读(304) 评论(0) 推荐(0) 编辑
摘要: n转化为b进制的格式,问你该格式是否为回文数字(即正着写和倒着写一样)输出Yes或者No并且输出该格式又是水题。。。 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> using namespa 阅读全文
posted @ 2017-04-18 15:27 辰曦~文若 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 有n个客户和k个窗口,给出n个客户的到达时间和需要的时长有空闲的窗口就去办理,没有的话就需要等待,求客户的平均时长。如果在8点前来的,就需要等到8点。如果17点以后来的,则不会被服务,无需考虑。 按客户的到达时间排序建立一个优先级队列,一开始放入k个窗口,初始结束时间为8*3600然后for循环客户 阅读全文
posted @ 2017-04-18 15:24 辰曦~文若 阅读(1083) 评论(4) 推荐(0) 编辑
摘要: 先判断n是否为素数然后把n转化成d进制下再反转,转化为十进制的num判断num是否为素数 注意n为0和1时,不是素数!!!注意反转后的num也有可能为1,不是素数!!! #include <iostream> #include <cstdio> #include <algorithm> #inclu 阅读全文
posted @ 2017-04-18 15:21 辰曦~文若 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 题目就是求联通分支个数删除一个点,剩下联通分支个数为cnt,那么需要建立cnt-1边才能把这cnt个联通分支个数求出来怎么求联通分支个数呢可以用并查集,但并查集的话复杂度是O(m*logn*k)我这里用的是dfs,dfs的复杂度只要O((m+n)*k)这里k是指因为有k个点要查询,每个都要求一下删除 阅读全文
posted @ 2017-04-18 15:19 辰曦~文若 阅读(438) 评论(0) 推荐(0) 编辑
摘要: 排序,水题因为最后如果一个学生最好的排名有一样的,输出的课程有个优先级A>C>M>E那么按这个优先级顺序进行排序每次排序前先求当前课程的排名然后再与目前最好的排名比较、更新 至于查询,建立id与索引的映射即可。 #include <iostream> #include <algorithm> #in 阅读全文
posted @ 2017-04-18 15:16 辰曦~文若 阅读(281) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 30 下一页