码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
【USACO】Transformations
A square pattern of size N x N (1 20 #include 21 #include 22 using namespace std; 23 24 //旋转90度的操作 25 int **transiformation_one(int before[][11],i...
分类:其他好文   时间:2014-05-16 03:10:30    阅读次数:361
数位DP
HDU 3555 BOMBhttp://acm.hdu.edu.cn/showproblem.php?pid=3555不能出现相邻的49正在学习。。。会了自己写#includeusing namespace std;LL dp[21][3],n; int len,bit[21];//dp[i][0]...
分类:其他好文   时间:2014-05-15 21:18:59    阅读次数:293
2013 到1 通过最小步数 到达1 2中运算 -1 或者除以2
d[n]=min(dp[n-1]+1,dp[n、2]); n为偶数 dp[n]=dp[n-1]+1; 答案为18 怎么通过计算求得答案? #includeusing namespace std;int d[2014];int min(int x,int y){ if(x>y) return y; e...
分类:其他好文   时间:2014-05-15 21:05:33    阅读次数:387
单链表的排序 快速排序 归并排序 quicksort mergesort
原理都很简单,关键是某些边界能否正确写对: #include #include using namespace std; class Node { public: int val; Node* next; Node(int val = 0):val(val),next(NULL){ } }; Node* quicksort(Node* head, Node* tai...
分类:其他好文   时间:2014-05-15 20:27:36    阅读次数:296
ZOJ 3635 线段树
线段树维护的是区间有多少个空位置,每次查询第X个空位置在哪,sum[rt]>=X就向左区间找,sum[rt] #include #include #include using namespace std; #define lson l , m , rt << 1 #define rson m + 1 , r , rt << 1 | 1 const int maxn = 55555; int...
分类:其他好文   时间:2014-05-15 20:19:48    阅读次数:256
wikioi 1282 约瑟夫问题 线段树
和上一题一样,寻找第K个位置,只不过需要处理一下下一个位置在哪,画图看看就知道了。 #include #include #include using namespace std; #define lson l , m , rt << 1 #define rson m + 1 , r , rt << 1 | 1 const int maxn = 30000+5; int sum[maxn<<...
分类:其他好文   时间:2014-05-15 20:07:28    阅读次数:262
算法 — partial_sort
partial_sort接受一个middle迭代器,使序列中的middle-first个最小元素以递增顺序排序,置于[first, middle)内。下面是测试代码: #include #include #include using namespace std; int main() { int a[] = {10,9,8,7,6,5,4,3,2,1,0}; vec...
分类:其他好文   时间:2014-05-15 19:23:27    阅读次数:361
链表程序实现
在这里实现了带头结点的链表,包含插入,删除,查询,清空链表一系列功能#includeusing namespace std;class LinkList{ char *elem; LinkList *next; static int length;public: LinkList(char *e) ...
分类:其他好文   时间:2014-05-15 18:05:31    阅读次数:271
类的集成,对基类私有成员的访问
派生类不能直接访问基类的私有成员,若要访问必须使用基类的接口,即通过其成员函数。实现方法有如下两种:1.在基类的声明中增加保护成员,将基类中提供给派生类访问的私有成员定义为保护成员。2.将需要访问基类私有成员的派生类成员函数声明为友元。#includeusing namespace std;clas...
分类:其他好文   时间:2014-05-15 17:44:44    阅读次数:234
sgu 102 Coprimes
太水了, 我都不忍心发题解, 但毕竟是sgu上一道题, 我试试能不能一直这么写下去,就是求phi,上代码#include #include #include #include #include #include #define N 10010using namespace std;int get.....
分类:其他好文   时间:2014-05-15 17:25:24    阅读次数:306
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!