码迷,mamicode.com
首页 >  
搜索关键字:pair    ( 2800个结果
poj 1470 Closest Common Ancestors LCA
题目链接:http://poj.org/problem?id=1470Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program ...
分类:其他好文   时间:2015-02-28 17:55:04    阅读次数:143
Codeforces Round #293 (Div. 2)
AVitaly and Strings题意:给定长度相等的字符串s,t,且s的字典序小于t,求一个字符串q字典序大于s小于t。分析:将字符串看做26进制的数,对s”+1“即可。#include #define pb push_back#define mp make_pair#define esp 1...
分类:其他好文   时间:2015-02-26 01:23:11    阅读次数:323
【SICP练习】57 练习2.27
?? 练习2.27 又是修改程序的题目,要求我们写出的deep-reverse函数要将表中的元素也反转过来,这其中应该要用到递归来实现吧。 (define (deep-reverse tree)    (cond ((null? tree) ‘())           ((not (pair? tree)) tree)           (else (r...
分类:其他好文   时间:2015-02-22 14:38:12    阅读次数:117
【SICP练习】58 练习2.28
?? 练习2.28 这道题是要我们找出树的所有树叶,参考第73页下面的count-leaves,当遍历这个树的时候也会有这三种情况:元素为空,元素不成对,以及元素成对。根据这个关系可以写出fringe如下: (define (fringe tree)    (cond ((null? tree) ‘())           ((not (pair? tree)) ...
分类:其他好文   时间:2015-02-22 14:35:50    阅读次数:144
CF 187C Weak Memory 优先队列 难度:2
http://codeforces.com/problemset/problem/187/C这道题可以用二分+dfs检测,或者优先队列解此处用了优先队列解法从起点出发,维护一个优先队列,内容是pair,则每一次取出的都一定是最小容量,也就是说结果必然大于等于这个容量#include #include...
分类:其他好文   时间:2015-02-21 12:00:20    阅读次数:106
PAT1010. Radix
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is...
分类:其他好文   时间:2015-02-17 12:53:45    阅读次数:155
【点分治】bzoj2152 聪聪可可
模板题。#include#include#include#includeusing namespace std;#define MAXN 20001#define INF 2147483647typedef pair Point;int n,K,ans,T[3];int v[MAXN<<1],w[M...
分类:其他好文   时间:2015-02-16 10:13:54    阅读次数:124
【点分治】bzoj1468 Tree
同poj1741。换了个更快的姿势,不会重复统计然后再减掉什么的啦~#include#include#includeusing namespace std;#define MAXN 40001#define INF 2147483647typedef pair Point;int n,K,ans;i...
分类:其他好文   时间:2015-02-15 21:48:41    阅读次数:194
【点分治】hdu5016 Mart Master II
点分治好题。①手动开栈。②dp预处理每个点被哪个市场控制,及其距离是多少,记作pair数组p。③设dis[u].first为u到重心s的距离,dis[u].second=u,到在统计的时候,若dis[u] 3 #include 4 #include 5 #include 6 using na...
分类:其他好文   时间:2015-02-13 16:28:57    阅读次数:132
Leetcode刷题笔记(部分非原创)(updating)
1. Two Sum 最基础的一道题,方法很多,用HashMap存pair是一种(HashSet和HashMap的方法在这里原理是一样的)。也可以sort the whole array first,then use two pointers, one start from the left sid...
分类:其他好文   时间:2015-02-13 13:00:58    阅读次数:127
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!