码迷,mamicode.com
首页 >  
搜索关键字:pair    ( 2800个结果
Topcoder SRM 648 Div2 1000
Topcoder SRM 648 Div2 1000 给一个长度为N的字符串S,S只含有‘A’、'B'、'C'三种元素。给定一个K,要求返回字符串S,使得S中恰好有K对pair(i,j)满足 0=<i<j<N,且 S[i]<S[j]。若不存在,则返回空串。...
分类:其他好文   时间:2015-02-03 09:36:18    阅读次数:234
POJ 2337 Catenyms (有向图欧拉通路)
Catenyms Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9914   Accepted: 2588 Description A catenym is a pair of words separated by a period such that t...
分类:其他好文   时间:2015-01-31 23:17:35    阅读次数:234
POJ2337---Catenyms
Catenyms Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9887   Accepted: 2583 Description A catenym is a pair of words separated by a period such that the las...
分类:其他好文   时间:2015-01-29 14:37:51    阅读次数:133
linux问题汇总---如何生成密钥对
准备:2台机器,ip分别为:192.168.0.195192.168.1.210目的:通过195ssh远程访问210.无需输入密码1、首先在195上生成密钥对。#cd /root/.ssh#ssh-keygen -t rsaGenerating public/private rsa key pair...
分类:系统相关   时间:2015-01-29 13:58:40    阅读次数:268
[Leetcode][Python]22: Generate Parentheses
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'22: Generate Parentheseshttps://oj.leetcode.com/problems/generate-parentheses/Given n pair...
分类:编程语言   时间:2015-01-27 23:04:14    阅读次数:162
Codeforces Round #287 (Div. 2) 解题报告
好久没写题了,底下代码都比较糟糕,将就着看吧。。507A Amr and Music要学最多的乐器,所以我们贪心选择时间花费少的。注意这里可以直接用pair,就不必写struct的compare函数了 1 #include 2 #include 3 #include 4 using namespac...
分类:其他好文   时间:2015-01-25 19:28:01    阅读次数:204
[topcoder]TheGridDivTwo
http://community.topcoder.com/stat?c=problem_statement&pm=13628&rd=16278标程是BFS,我用DFS,都可解。这里复杂的把pair写了hash函数,其实直接用个矩阵来存bool就可以了。#include #include #incl...
分类:其他好文   时间:2015-01-24 00:28:13    阅读次数:126
UVa 439 Knight Moves(BFS应用)
题意  求国际象棋中骑士从一个位置移东到另一个位置所需最少步数 基础的BFS应用 #include using namespace std; int x[] = { -2, -1, -2, -1, 1, 2, 1, 2}; int y[] = { -1, -2, 1, 2, -2, -1, 2, 1}; int d[15][15], sx, sy, ex, ey; pair q[105], ...
分类:其他好文   时间:2015-01-23 20:13:47    阅读次数:209
Dijkstra[两种邻接表+优先队列优化]
Dijksta算法中,如果我们采用的是邻接矩阵来存的,第一点浪费的空间比较多,第二点我们知道算法的时间复杂度在O(n*n),这样的算法可以说并不是很好,所以我们考虑优化它首先我们可以优化存储结构,采用邻接表来存储,其次我们可以用优先队列来排序大小,其时间复杂度大大降低。 需要注意的是pair是按照第一个元素的大小排序,如果相同才按照第二个,所以我们要把d[i]包装在第一个元素上。 vect...
分类:其他好文   时间:2015-01-22 18:23:48    阅读次数:150
【分治法】在数组A中,返回i<j,且A[i]>A[j]的(i,j)配对的数量
题目:EPI 在本题中,把数组分成左右两部分,分别计算左右两部分的invrted pair的数量,再计算A[i] 和 A[j]一边一个的情况,然后把三者相加。 int count_invert_core(vector &arr,int begin,int end) { if (end - begin + 1 < 2) return 0; if (end - begin + 1 ...
分类:编程语言   时间:2015-01-22 09:36:34    阅读次数:189
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!