- 博客(18)
- 资源 (8)
- 收藏
- 关注
原创 图论:回路判断和拓扑排序(DFS)
拓扑排序的定义是:将有向图中的顶点以线性方式进行排序。即对于任何连接自顶点u到顶点v的有向边uv,在最后的排序结果中,顶点u总是在顶点v的前面。适用范围:有向无环图(DAG),如果图中存在环路的话那么讨论就没有意义,当然在编程中需要对图是否有环进行判断。#include #include #include using namespace std;const int MAX = 5
2014-02-28 17:05:30 11352 3
原创 UVa 679 - Dropping Balls 数学分析
Dropping Balls A number of K balls are dropped one by one from the root of a fully binary tree structure FBT. Each time the ball being dropped first visits a non-terminal node. It then keeps moving do
2014-02-28 08:59:06 2010
原创 UVa 514 - Rails 注意最后的输出
Rails There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It
2014-02-27 13:20:15 1685
原创 UVa 10935 - Throwing cards away I STL
Problem B: Throwing cards away IGiven is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at
2014-02-27 12:28:04 1849
原创 UVa 10055 - Hashmat the Brave Warrior 注意格式
Problem AHashmat the brave warriorInput: standard inputOutput: standard output Hashmat is a brave warrior who with his group of young soldiers moves from one place to another to fight ag
2014-02-27 12:00:27 1638
原创 操作系统——信号量机制
信号量在长期的应用中得到发展,从整型信号量发展为记录型信号量,进而推广到AND 信号量。(1)整型信号量。 即一个整型值。int s;信号量上一共有两种操作:一种是P 操作,写为Wait(s) 或P(s); 另一种是 V 操作,写为Signal(s) 或 V(s). P(s): while s s := s-1;V(s): s:= s+1;(2) 利用信号量描述前趋
2014-02-24 23:32:24 4613
原创 2013年阿里算法笔试题解题报告
解答题:1、有一个算法,查找n个元素的的数组的最大值和最小值,要比较2n次;请写一个最高效的算法,并说明他要比较的次数。请注意复杂度的常数(不用写代码,说明步骤和过程即可,要定出比较的次数,没写不给分)2、有三个非递减序列的数组a[l]、b[m]、c[n],求他们之间的最小距离。已知距离的定义如下:distance = max(|a[i]-b[j]|, |a[i]-c[k]
2014-02-24 11:05:22 1775
原创 UVa 10881 - Piotr's Ants
Piotr's AntsTime Limit: 2 seconds"One thing is for certain: there is no stopping them;the ants will soon be here. And I, for one, welcome ournew insect overlords."Kent Brockman
2014-02-24 10:24:11 1080
原创 LA 3708- Graveyard
Programming contests became so popular in the year 2397 that the governor of New Earck -- the largest human-inhabited planet of the galaxy -- opened a special Alley of Contestant Memories (ACM) at the
2014-02-23 18:39:17 1021
原创 UVa 11300 Spreading the Wealth
注意:给定数轴上的n 个点,在数轴上的所有点中,中位数离所有顶点的距离之和最小。 F. Spreading the Wealth ProblemA Communist regime is trying to redistribute wealth in a village. They have have decided tosit eve
2014-02-23 13:58:16 1063
原创 UVa 11729 Commando War 贪心
GCommando WarInput: Standard InputOutput: Standard Output “Waiting for orders we held in the wood, word from thefront never cameBy evening the sound of the gunfire was mil
2014-02-23 10:13:00 1006
原创 UVa 11292 The Dragon of Loowater 简单的比较题
Problem C: The Dragon of LoowaterOnce upon a time, in the Kingdom of Loowater, a minor nuisance turnedinto a major problem.The shores of Rellau Creek in central Loowater had always been a primebre
2014-02-23 08:57:20 1069
原创 poj 3280 Cheapest Palindrome DP
Cheapest PalindromeTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5173 Accepted: 2512DescriptionKeeping track of all the cows can be a tricky task so F
2014-02-22 21:02:48 959
原创 poj 3616 Milking Time DP
Milking TimeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4129 Accepted: 1720DescriptionBessie is such a hard-working cow. In fact, she is so focuse
2014-02-21 19:32:13 1447
原创 poj 2229 Sumsets DP
SumsetsTime Limit: 2000MS Memory Limit: 200000KTotal Submissions: 11618 Accepted: 4677DescriptionFarmer John commanded his cows to search for different sets of nu
2014-02-20 13:22:39 1211
原创 poj 3262 贪心
Protecting the FlowersTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3575 Accepted: 1465DescriptionFarmer John went to cut some wood and left N (2 ≤ N
2014-02-19 11:23:08 1927
原创 poj 1862 贪心
StripiesTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 11128 Accepted: 5327DescriptionOur chemical biologists have invented a new very useful form of lif
2014-02-19 10:21:36 1151
原创 poj 2393
Source CodeProblem: 2393 User: zoujinyongMemory: 252K Time: 94MSLanguage: C++ Result: AcceptedSource Code#include #include using namespace std;int main(){ int N, S; cin >> N >> S;
2014-02-18 19:25:53 1237
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人