码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
hust 1463 - 第二届“华为杯”初赛题目H
题目描述有m个盒子,第i个盒子的长尾hi,宽为wi。如果两个盒子i,j满足hi#include#includeusing namespace std;const int maxn=20001;struct node{ int x,y;}box[maxn];int a[maxn];bool cm...
分类:其他好文   时间:2014-05-20 02:11:24    阅读次数:251
计算十进制数转化成二进制时1的个数
#include using namespace std;int func(int x){ int cnt = 0; while (x) { cnt++; x = x&(x - 1); } return cnt;}int main(){ ...
分类:其他好文   时间:2014-05-17 14:54:19    阅读次数:194
[xyz模拟题]动态维护树的直径
专出神题的xyz。支持删加边、修改点权、维护树的直径。LCT 需要额外记录子树信息。用一个堆维护。#include#include#include#include#include#includeusing namespace std;#define rep(i,x,y) for(i=x;i=y;i....
分类:其他好文   时间:2014-05-17 14:29:38    阅读次数:667
模板具体化
#ifndef SWAP_H_INCLUDED#define SWAP_H_INCLUDED#include using namespace std;struct Job{ string name; int salary;};template void Swap(T &a, T &b);...
分类:其他好文   时间:2014-05-16 01:14:38    阅读次数:340
hud 1312 Red and Black
题目:     链接:点击打开链接 题意:     DFS搜索 算法:     dfs 思路:     简单题 代码: #include #include #include using namespace std; int w,h; char s[30][30]; int vis[30][30]; int cnt; void dfs(int x,int y) { if...
分类:其他好文   时间:2014-05-16 00:02:10    阅读次数:438
poj 1200 Crazy Search
题目:     链接:点击打开链接 题意:     输入n和nc,以及字符串s,输出长度为n的不同字串的个数。 算法:      思路:     用hash判重(hash值。。。。。。),看了大牛的代码,对hash还是不甚理解。。。。 代码:#include #include #include #include using namespace std; #define MAXN 1...
分类:其他好文   时间:2014-05-15 23:25:24    阅读次数:404
hdu 2955 Robberies
题目:     链接:点击打开链接 题意:     roy抢银行,知道每个银行的存款和被抓的概率,以及Roy能够被抓的概率,求他能够抢劫的最多的money。 思路:     dp[i]表示抢劫i块钱不被抓的概率,当i==0时,一定不会被抓,即dp[0] = 1; 代码: #include #include #include using namespace std; #define M...
分类:其他好文   时间:2014-05-15 23:05:08    阅读次数:266
HDU 4811 Ball(贪心)
http://acm.hdu.edu.cn/showproblem.php?pid=4811 推理一下,发现可以先求出后面放小球可以加分的最大值,然后前面的和为0 + 1 + 2 + ...+ max,max最大为6,因为每个球最多算左右两边 代码: #include #include using namespace std; long long a, b, c; long long ...
分类:其他好文   时间:2014-05-15 23:04:28    阅读次数:387
HDU 4006 求第k大数 treap
裸题,瞬秒。。 #include #include #include #include #include #include #include #include using namespace std; #define L(id) tree[id].ch[0] #define R(id) tree[id].ch[1] #define Size(id) tree[id].size #...
分类:其他好文   时间:2014-05-15 22:52:51    阅读次数:328
hdu 2602 Bone Collector
题目;     点击打开链接 代码; #include #include #include using namespace std; struct beibao{ int val; int vol; }bag[1010]; int main() { int dp[1010]; int i,j,n,v; int t; cin>>t; wh...
分类:其他好文   时间:2014-05-15 22:50:51    阅读次数:394
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!