码迷,mamicode.com
首页 >  
搜索关键字:docker lxc namespace    ( 59041个结果
wikioi 1163 访问艺术馆 树形dp
递归建树,由题知该树是一棵二叉树,且除根节点外其他点的度为0或2。 dp[i][j]表示来到第i个走廊(还未走过这条走廊)还剩下j时间,能拿到最大的画的数量。 dp[i][j]=max(dp[i][j],dp[lson[i]][k]+dp[rson][last_time-k]) #include #include using namespace std; int dp[200][70...
分类:其他好文   时间:2014-05-07 05:02:45    阅读次数:295
HDU 4722 Good Numbers (数位dp)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4722 思路:数位dp,dp[i][j]表示到第i位,数字和%10为j,然后进行dp,注意完全匹配的情况是要+1,而其他情况是从0 到 9 都要考虑 代码: #include #include #include #include using namespace std; int t; l...
分类:其他好文   时间:2014-05-07 04:55:37    阅读次数:314
UVA11107 后缀数组(new模板)
以前的模板和题目 白书例题,基本模板,多个串连接时的处理,二分加分组的处理。 注意n和m的值 n为字符个数 m为最大字符值+1 分组时,分出来的区间是[ ),左闭右开 idx[],的有效只是1-t-1,为t表示自己添加的字符 #include #include #include #include using namespace std; const int maxn = ...
分类:其他好文   时间:2014-05-07 04:50:29    阅读次数:250
矩阵压缩存储之三元组顺序表
形态: 实现:/***************************************** 稀疏矩阵的三元组顺序表存储表示 by Rowandjj 2014/5/3 ******************************************/ #include using namespace std; #define MAXSIZE 12500//非零元个数的最大值 ...
分类:其他好文   时间:2014-05-07 04:42:40    阅读次数:387
递归法求解汉罗塔hanoi问题
#include using namespace std; //汉罗塔递归求解函数 从a移到c void move(int m,char a,char c); void hanoi(int n,char a,char b,char c) { if(1==n) { move(n,a,c); return; } hanoi(n-1,a,c,b); move(n,a,c); hano...
分类:其他好文   时间:2014-05-07 03:24:14    阅读次数:228
简易迷宫游戏
人控制方向: #include using namespace std; #define n 8 int * createMaze(){ int i,j; int * a; a=new int[n*n]; for(i=0;i<n;i++){ for(j=0;j<n;j++){ *(a+n*i+j)=0; } } *(a+n*0+1)=3; *(a+n*1+1)=1;...
分类:其他好文   时间:2014-05-07 03:10:02    阅读次数:319
十一周 项目2 职员有薪水了
#include using namespace std; class CPerson { protected: string m_szName; string m_szId; int m_nSex;//0:women,1:man int m_nAge; public: CPerson(string name,string id,int...
分类:其他好文   时间:2014-05-07 03:04:18    阅读次数:239
算法导论 学习问题
《算法导论》里的COUNTING_SORT,用C++实现有问题: #include #include using namespace std; void COUNTING_SORT(vectorint>&A, vectorint>&B, const int& k) { int* C = new int[k + 1](); for (unsigned j = 0; j A.size();...
分类:其他好文   时间:2014-05-07 02:59:30    阅读次数:251
括号匹配问题,用栈实现
用栈实现括号匹配其实是一个很简单的问题,思路在代码注释里面写的很清楚了,只是接口设置的好像不太好。 如果在main里面设置的str不是动态分布的,在linux下就会出错,不知道windows会不会出问题。 kuohao.cpp #include #include "stack.cpp" using namespace std; //仅用于检测(),{},[],其他的符号原理都是一样的 bo...
分类:其他好文   时间:2014-05-07 02:39:17    阅读次数:247
【算法导论实验5】贪心-活动安排问题与背包问题
首先是活动安排问题。 贪心的关键在于排序策略。 思路很简单,对所有活动的结束时间排序,如果结束时间相同,因为要尽量多的参加活动,所以选取开始时间尽量晚的(这样可以安排的比较多),然后依次从早到晚选取不冲突的活动加入,即为最多可以参加的活动。 #include #include #include #include #include using namespace std; clas...
分类:其他好文   时间:2014-05-06 23:01:00    阅读次数:394
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!