思路: 建图!!! 之后枚举最大等级,求到物品1的最短路。 1 2 #include 3 #include 4 #include 5 #define maxn 0x3ffffff 6 using namespace std; 7 typedef pair pii; 8 int visit...
分类:
其他好文 时间:
2015-03-15 12:04:37
阅读次数:
137
#include
using namespace std;
#define INF 0x7ffffff
#define maxn 105
typedef pair P;
int dp[maxn][maxn], n, m;
char maze[maxn][maxn];
int sx, sy, ex, ey;
int go[4][2] = {{-1,0},{1,0},{0,-1},{0,1}...
分类:
其他好文 时间:
2015-03-14 16:58:43
阅读次数:
123
record save here first[root@hadoop .ssh]# ssh-keygen -t rsa -P ''Generating public/private rsa key pair.Enter file in which to save the key (/root/.ss...
分类:
其他好文 时间:
2015-03-12 00:45:58
阅读次数:
184
http://acm.hdu.edu.cn/showproblem.php?pid=5183
Problem Description
When given an array (a0,a1,a2,?an?1) and
an integer K,
you are expected to judge whether there is a pair (i,j)(0≤i≤jn) wh...
分类:
其他好文 时间:
2015-03-11 23:28:53
阅读次数:
205
题意:When given an array(a0,a1,a2,?an?1)and an integerK, you are expected to judge whether there is a pair(i,j)(0≤i≤j st;ll ans,K;int n;int T;ll a[10000...
分类:
其他好文 时间:
2015-03-11 21:20:46
阅读次数:
143
#include#include#includeusing namespace std;#define MAXN 10001#define INF 2147483647typedef pair Point;int n,m,Ks[101];bool vis[101];int v[MAXN<<1],w[...
分类:
其他好文 时间:
2015-03-11 10:49:12
阅读次数:
122
2sum的夹逼算法,需要sort一下。本身不难,但是tricky的地方在于允许同一个数组元素自己跟自己组成一个pair,比如上例中的[5, 5]。而且数组本身就允许值相等的元素存在,在计算pair时,算成不同的pair,比如数组是[3,3],K=6,这时的pair有[0, 0], [0, 1], [...
分类:
其他好文 时间:
2015-03-09 12:31:00
阅读次数:
154
今天逛cplusplus.com发现C++还真多了不少方便使用的特性,先了解些最常用的初始化列表 vector tmp({1,2,3,4}); vector > tmp_pair( { {1, 2}, {3, 4} ...
分类:
编程语言 时间:
2015-03-09 12:24:41
阅读次数:
124
问题描述:
对一个输入文本中的每个单词的出现次数统计,并选取出现频率最大的10个单词
#include
#include
#include string>
#include
#include
#include
using namespace std;
typedef pairstring, int> PAIR;
int cmp...
分类:
其他好文 时间:
2015-03-09 11:04:33
阅读次数:
119
第11章 关联容器
1. 使用map的简单例子:
运行结果为:
2. 初始化map和set:
3. set与multiset的区别:
4. 使用map和set时,其元素类型必须是定义了严格弱序的(即定义了号比较的),如果元素类型没有定义
5. pair类型:pair是一个用来生成特定类型的模板. pa...
分类:
编程语言 时间:
2015-03-09 10:58:03
阅读次数:
294