上一页 1 ··· 8 9 10 11 12 13 下一页
摘要: 一种算法是分治法:O(nlgn) 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxsize=1000001; 6 int a[maxsize],sum[maxsize],n,inf=(1=low;i--){... 阅读全文
posted @ 2015-01-06 01:02 流白 阅读(384) 评论(0) 推荐(0) 编辑
摘要: heap的定义:如果数组a[1,....n]满足:a[i]>a[2*i]&&a[i]>a[2*i+1],1 2 #include 3 using namespace std; 4 int a[101]; 5 int array_size,heap_size; 6 int left(int i){ 7... 阅读全文
posted @ 2015-01-04 19:58 流白 阅读(3192) 评论(0) 推荐(0) 编辑
摘要: 红果果的dijstra算法应用,这里采用邻接表存储图小插曲:while(scanf("%d",&n))提交时内存超限,改成while(scanf("%d",&n)!=EOF)就AC了,不知道为什么dijstra算法应用:已知定点为输入,输入图中所有其他点到该定点的最短距离。具体做法:a.初始时,S只... 阅读全文
posted @ 2015-01-03 19:52 流白 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 经典的DP问题,DP思想也很直接:直接贴代码: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int max_size=1001; 7 int n, a[max_size][max_size]; ... 阅读全文
posted @ 2015-01-01 18:48 流白 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 转载自:http://blog.csdn.net/speedme/article/details/242311971. 什么是动态规划-------------------------------------------dynamic programmingis a method for solvi... 阅读全文
posted @ 2015-01-01 17:37 流白 阅读(473) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 long long ans; 5 void merge(int *a,int le,int mid,int rt){ 6 int *sort_data=(int *)malloc(sizeof(i... 阅读全文
posted @ 2014-12-31 17:19 流白 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 又一次因为一个小错误,POJ上Wrong Answer了无数次。。。。。在差不多要放弃的时候,发现了这个猥琐的不能再猥琐的bug,改完了提交就AC了,简直无语。。。。本题wo采用模拟方法: 1 #include 2 #include 3 #include 4 using namespace std;... 阅读全文
posted @ 2014-12-30 19:55 流白 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef struct node{ 7 int id; 8 node *next; 9 node();10 node(in... 阅读全文
posted @ 2014-12-28 14:36 流白 阅读(396) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 const int max_size = 101; 6 typedef struct arcNode{ 7 int node; 8 arcNode *... 阅读全文
posted @ 2014-12-28 00:34 流白 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 一、简答题1. 动态链接库和静态链接库的优缺点2. 轮询任务调度和可抢占式调度有什么区别?3. 列出数据库中常用的锁及其应用场景二、算法设计题1. 给定N是一个正整数,求比N大的最小“不重复数”,这里的不重复是指没有两个相等的相邻位,如1102中的11是相等的两个相邻位故不是不重复数,而12301是... 阅读全文
posted @ 2014-12-27 23:46 流白 阅读(200) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 下一页