码迷,mamicode.com
首页 >  
搜索关键字:namespace    ( 41927个结果
HDU 1542 Atlantis 矩形面积并
题目来源:HDU 1542 Atlantis 题意:给你一些矩形(左下角和右上角)求面积 思路:参考here这个超赞的 一看就懂了 #include #include #include #include using namespace std; const int maxn = 210; struct node { double l, r, h; int s, val; nod...
分类:其他好文   时间:2014-05-07 08:59:09    阅读次数:395
C++对象模型
#include using namespace std; class Base   {   public:       Base(){base = 1; cout     virtual ~Base(){cout     virtual void say(){cout private:     int base;       static int count; };...
分类:编程语言   时间:2014-05-07 06:59:24    阅读次数:302
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
算法导论 学习问题
《算法导论》里的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
【算法导论实验5】贪心-活动安排问题与背包问题
首先是活动安排问题。 贪心的关键在于排序策略。 思路很简单,对所有活动的结束时间排序,如果结束时间相同,因为要尽量多的参加活动,所以选取开始时间尽量晚的(这样可以安排的比较多),然后依次从早到晚选取不冲突的活动加入,即为最多可以参加的活动。 #include #include #include #include #include using namespace std; clas...
分类:其他好文   时间:2014-05-06 23:01:00    阅读次数:394
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!