A - Chewbaсca and Number
大于4的倒置,小于等于4的不倒置。注意第一位如果是9则不倒置。
代码如下:#include
#include
#include
#include
#include
#include
#include
#inclu...
分类:
其他好文 时间:
2015-02-16 00:30:28
阅读次数:
289
题目链接Solution DFS+剪枝 对于一个走过点k,如果有必要再走一次,那么一定是走过k后在k点的最大弹药数增加了.否则一定没有必要再走. 记录经过每个点的最大弹药数,对dfs进行剪枝.#include #include #include #include #include using...
分类:
其他好文 时间:
2015-02-16 00:24:29
阅读次数:
111
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5174题目意思:给出 n 个人坐的缆车值,假设有 k 个缆车,缆车值 A[i] 需要满足:A[i?1] 2 #include 3 #include 4 #include 5 using namesp...
分类:
其他好文 时间:
2015-02-16 00:22:56
阅读次数:
237
题目链接 要添最少的挡板使所有的'D'不存在到达网格外的路径. 以每个格子向四个方向中可以到达的格子连容量为1的边, 从源点向所有'D' 连容量为4的边,网格外的点向汇点连一条容量为4的边. 答案就是这个容量网络的最小割,即最大流./* 最大流SAP 邻接表 ...
分类:
其他好文 时间:
2015-02-16 00:22:39
阅读次数:
183
原题地址:https://oj.leetcode.com/problems/repeated-dna-sequences/题目内容:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for ex...
分类:
其他好文 时间:
2015-02-15 11:53:05
阅读次数:
232
题目链接:http://codeforces.com/problemset/problem/514/B题目意思:给出双头枪的位置(x0, y0),以及 n 个突击队成员的坐标。双头枪射击一次,可以把它对住的方向(是直线,不是射线,因为是双头嘛)所有的人射杀掉。问将所有突击队成员消灭的最少射击数是多少...
分类:
其他好文 时间:
2015-02-15 11:51:57
阅读次数:
128
题目链接:http://poj.org/problem?id=2051题目意思:题目有点难理解,所以结合这幅图来说吧~~~~ 有一个叫Argus的系统,该系统支持一个 Register 命令,输入就是类似样例中的: Register 2004 200 代表编号为 2004 的 Register...
分类:
其他好文 时间:
2015-02-13 01:27:05
阅读次数:
169
Ultra-QuickSortTime Limit:7000MSMemory Limit:65536KTotal Submissions:44671Accepted:16240DescriptionIn this problem, you have to analyze a particular s...
分类:
其他好文 时间:
2015-02-11 18:06:47
阅读次数:
207
背景:做这道题的时候,完全无法理解题意,无赖使用了百度翻译,可翻译出来的东西一点也不容易理解,最后实在没办法了,就看了解题报告里面的大致题意描述。
思路:首先用vector存储括号,右括号用0表示,左括号用1表示,并在存储过程中,用另外一个vector存储下右括号在整个brackets中的位置,这样就可以少一次检索,然后在依次处理brackets数组中的元素。
学习:vector的使用。
#...
分类:
其他好文 时间:
2015-02-10 13:21:57
阅读次数:
142
题目
LeetCode题目如下:
mplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the...
分类:
其他好文 时间:
2015-02-09 21:44:38
阅读次数:
206