题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5154题目意思:有 n 门 processes(编号依次为1,2,...,n),然后给出 m 种关系: a,b。表示 process b 要在 process a 之前完成。问经过 m 种关系之后,有没有...
分类:
其他好文 时间:
2015-01-11 00:53:25
阅读次数:
238
LeetCode Plus One Java版解题报告
题意:一个整数按位存储于一个int数组中,排列顺序为:最高位在array[0] ,最低位在[n-1],例如:98,存储为:array[0]=9; array[1]=8;
解题思路,从数组的最后一位开始加1,需要考虑进位,如果到[0]位之后仍然有进位存在,需要新开一个长度为(n.length + 1)的数组,拷贝原来的数组。...
分类:
编程语言 时间:
2015-01-10 23:45:27
阅读次数:
363
[NOI1999] 内存分配
时间限制:1 s 内存限制:128 MB
内存是计算机重要的资源之一,程序运行的过程中必须对内存进行分配。
经典的内存分配过程是这样进行的:
内存以内存单元为基本单位,每个内存单元用一个固定的整数作为标识,称为地址。地址从0开始连续排列,地址相邻的内存单元被认为是逻辑上连续的。我们把从地址i开始的s个连续的内存单元称为首地址为i长度为s的地址片。
运行过程中有若干进程需要占用内存,对于每个进程有一个申请时刻T,需要内存单元数M及运行时间P。在运行时间P内(即T时刻开始,T+...
分类:
其他好文 时间:
2015-01-10 14:00:49
阅读次数:
233
796. [APIO2012] 派遣
【问题描述】
在一个忍者的帮派里,一些忍者们被选中派遣给顾客,然后依据自己的工作获取报偿。
在这个帮派里,有一名忍者被称之为Master。除了Master以外,每名忍者都有且仅有一个上级。为保密,同时增强忍者们的领导力,所有与他们工作相关的指令总是由上级发送给他的直接下属,而不允许通过其他的方式发送。
现在你要招募一批忍者,并把它们派...
SubsetsGiven a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set mus...
分类:
其他好文 时间:
2015-01-08 21:27:08
阅读次数:
361
Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A sol...
分类:
其他好文 时间:
2015-01-07 14:40:01
阅读次数:
173
有用的c++函数总结
find()函数; string成员函数有这个,algorithm库中也有这个 ,可以在容器中查找元素
string的at函数,比如string str; str.at(pos)能够检查越界 比 str[pos] 安全。当然你可以根据自己的需求选择使用哪一种表示方式,但是在c中你就没的选
erase函数可以选择性地删除字符串中一部分,我们可以想见其效率有多慢,但是总比自己写代码要爽
insert函数 就是插入函数
reverse函数 反转字符串的一部分 是algorithm库...
分类:
其他好文 时间:
2015-01-06 18:04:33
阅读次数:
413
解题思路:首先是没有思路的----然后看了几篇解题报告 http://blog.csdn.net/ditian1027/article/details/20804911 http://poj.org/showmessage?message_id=152847 http://blog.163.com/...
分类:
其他好文 时间:
2015-01-06 13:40:00
阅读次数:
138
【题目】Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum...
分类:
其他好文 时间:
2015-01-05 10:54:18
阅读次数:
146
Find Peak ElementA peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and ...
分类:
其他好文 时间:
2015-01-05 06:58:46
阅读次数:
193