摘要: 给出n个城市,m条边,起始点c1和目的点c2接下来给出n个城市的队伍数以及m条双向边问你求c1到c2的所有最短路径数目,以及其中经过的最多队伍数 先最短路dijkstra,同时建立vector数组pre存储前驱节点然后dfs求出路径,以及每条路径经过的队伍数,更新最大值即可 #include <io 阅读全文
posted @ 2017-04-19 20:33 辰曦~文若 阅读(722) 评论(0) 推荐(0) 编辑
摘要: 给出n和k接下来n行,每行给出a,b,c,表示a和b之间的关系度,表明他们属于同一个帮派一个帮派由>2个人组成,且总关系度必须大于k。帮派的头目为帮派里关系度最高的人。(注意,这里关系度是看帮派里边的和,而不是帮派里所有个人的总和。如果是按个人算的话,相当于一条边加了两次,所以应该是>2*k)问你有 阅读全文
posted @ 2017-04-19 20:16 辰曦~文若 阅读(450) 评论(0) 推荐(0) 编辑
摘要: 模拟先说一下例子,最后为方便起见,在目的地安增加一个费用为0的加油站0 1 2 3 4 5 6 7 87.1 7.0 7.2 6.85 7.5 7.0 7.3 6.0 00 150 200 300 400 600 1000 1250 1300车子加满了最多开50*12=600的距离0.第0个加油站6 阅读全文
posted @ 2017-04-19 20:07 辰曦~文若 阅读(454) 评论(0) 推荐(1) 编辑
摘要: #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> using namespace std; /* 链表题 水 */ int n; struct Word{ i 阅读全文
posted @ 2017-04-19 20:05 辰曦~文若 阅读(198) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> using namespace std; int n; int n1,n2,n3; char str[100 阅读全文
posted @ 2017-04-19 20:04 辰曦~文若 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 模板题最短路+输出路径如果最短路不唯一,输出cost最小的 #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> #include <queue> #define 阅读全文
posted @ 2017-04-19 20:02 辰曦~文若 阅读(327) 评论(0) 推荐(0) 编辑
摘要: 这个是原先AC的代码,但是目前最后一个样例会超内存,也就是开不了两个数组来保存两个序列了,意味着我们只能开一个数组来存,这就需要利用到两个数组都有序的性质了。 #include <iostream> #include <cstdio> #include <algorithm> #include <s 阅读全文
posted @ 2017-04-19 20:01 辰曦~文若 阅读(406) 评论(8) 推荐(0) 编辑
摘要: #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> #include <queue> using namespace std; /* 水排序 */ const 阅读全文
posted @ 2017-04-19 19:59 辰曦~文若 阅读(210) 评论(0) 推荐(0) 编辑
摘要: #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) 编辑