上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页
摘要: 习题2.1.2#include using namespace std;void insectionSort(int a[],int len){ for(int i=1;ia[j]&&j>=0)//用t来比较而不是用a[i] 因为a[i]会变 { ... 阅读全文
posted @ 2018-04-29 15:59 LandingGuys 阅读(288) 评论(0) 推荐(0) 编辑
摘要: //spfa算法模板(邻接矩阵)://c++ code:void spfa(int s){ for(int i=0; i0 && dis[i]>dis[v]+a[v][i]){ dis[i] = dis[v]+a[v][i]; 修改最短路 if (... 阅读全文
posted @ 2018-04-27 22:02 LandingGuys 阅读(189) 评论(0) 推荐(0) 编辑
摘要: (20 分)设计一个日期类 Date, 要求:(1) 公元前年份的表达方式遵守 ISO8601 标准:公元 1 年为 1,公元前 1 年为 0,公元前 2 年为-1,以此类推;(2) 在 1752 年 9 月 2 日之前使用儒略历,其后一天起使用格利历,调整为 175... 阅读全文
posted @ 2018-04-26 19:45 LandingGuys 阅读(140) 评论(0) 推荐(0) 编辑
摘要: void maxheap(int i){ int left=i*2,right=i*2+1; if(a[left]>a[i]&&lefta[i]&&right1&&a[i/2]<a[i]) { swap(a[i],a[i/2]); ... 阅读全文
posted @ 2018-04-25 22:08 LandingGuys 阅读(106) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define INF 9999999using namespace std;int n,sum;string s[2005];short book[2001];int low[2001];int e[2001][... 阅读全文
posted @ 2018-04-20 17:00 LandingGuys 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 什么是负环如果存在一个环(从某个点出发又回到自己的路径),而且这个环上所有权值之和是负数,那这就是一个负权环,也叫负权回路存在负权回路的图是不能求两点间最短路的,因为只要在负权回路上不断兜圈子,所得的最短路长度可以任意小。bellman-Ford核心 for(k=1;... 阅读全文
posted @ 2018-04-19 21:30 LandingGuys 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Firstly create a Person base class#ifndef PERSON_H#define PERSON_H#include using namespace std;class Person{private: int age,gender... 阅读全文
posted @ 2018-04-18 11:18 LandingGuys 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 1.第二次做了还是没有思路2.我是从字符串的长度考虑,如果长度=1 ,就会怎样 长度=3 就有多少种可能,并且打算用递归的算法,把一个字符串分解成几小部分来解,但是问题来了,我应该怎么分解对于一个字符串,第一个肯定是运算符,但是后面应该怎么拆分,拆分后又怎么能够利用子... 阅读全文
posted @ 2018-04-17 16:11 LandingGuys 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 果然好久没A题,都不记得题目给的数据有可能有坑。。。1.注意小岛的y有可能是负数。。。2.看清题目,坐标为整数4.关于priority queue 要想它先吐出小的数可以按照下面结构体的运算符重载 5.思路1)将小岛从左到右编号1~n。2)访问第一个小岛,根据小岛坐标... 阅读全文
posted @ 2018-04-16 21:24 LandingGuys 阅读(86) 评论(0) 推荐(0) 编辑
摘要: dfs 有翻和不翻两种选择,妙#include using namespace std;int map[4][4];int next[4][2]= {{0,1},{1,0},{0,-1},{-1,0}};void turn(int x,int y){ int t... 阅读全文
posted @ 2018-04-16 19:43 LandingGuys 阅读(118) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页