自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

codeforces Epic Game 题解

Simon and Antisimon play a game. Initially each player receives one fixed positive integer that doesn't change throughout the game. Simon ...

2014-04-30 07:16:00 135 0

Codeforces Helpful Maths

Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation. The tea...

2014-04-30 07:11:00 98 0

Unique Binary Search Trees -- LeetCode

原题链接:http://oj.leetcode.com/problems/unique-binary-search-trees/这道题要求可行的二叉查找树的数量,其实二叉查找树可以任意取根,只要满足中序遍历有序的要求就可以。从处理子问题的角度来看,选取一个结点为根,就把结点切成左右子树,以这个结点...

2014-04-30 06:16:00 92 0

Unique Binary Search Trees II -- LeetCode

原题链接:http://oj.leetcode.com/problems/unique-binary-search-trees-ii/这道题是求解所有可行的二叉查找树,从Unique Binary Search Trees中我们已经知道,可行的二叉查找树的数量是相应的卡特兰数,不是一个多项式时...

2014-04-30 06:15:00 79 0

【图像处理】Gabor滤波器

Gabor的核函数参考的wiki 使用实数Real的公式计算核函数代码: Mat gaborFilter(Mat& img, Mat& filter){ int half_filter_size = (max(filter.rows,filter.cols)-...

2014-04-30 00:36:00 131 0

Codeforces A. Double Cola 题解

题目很奇怪,就是5个人排队喝可乐,喝完之后编程两个人,然后拍在队后面,然后继续喝可乐。 给出个数值,代表第几罐可乐,问会是第几个人喝到? http://codeforces.com/problemset/problem/82/A 一个数学问题,仔细点就好了。 要熟练的知识点: 1...

2014-04-29 18:16:00 94 0

Timus 1119. Metro 动态规划

Many of SKB Kontur programmers like to get to work by Metro because the main office is situated quite close the station Uralmash. So, since a sed...

2014-04-29 15:05:00 65 0

Timus 1104. Don’t Ask Woman about Her Age题解

Mrs Little likes digits most of all. Every year she tries to make the best number of the year. She tries to become more and more intelligent and ...

2014-04-29 12:27:00 54 0

Timus 1446. Sorting Hat 分类问题

At the start of each school year, a very important event happens at Hogwarts. Each of the first-year wizards and witches is assigned to one of th...

2014-04-29 09:31:00 65 0

Timus 1777. Anindilyakwa 奇怪的数数问题

The language of Australian aborigines anindilyakwa has no numerals. No anindilyakwa can say: “I've hooked eight fishes”. Instead, he say...

2014-04-29 08:43:00 59 0

Restore IP Addresses -- LeetCode

原题链接:http://oj.leetcode.com/problems/restore-ip-addresses/这道题的解法非常接近于NP问题,也是采用递归的解法。基本思路就是取出一个合法的数字,作为IP地址的一项,然后递归处理剩下的项。可以想象出一颗树,每个结点有三个可能的分支(因为范围是0...

2014-04-29 05:01:00 47 0

Interleaving String -- LeetCode

原题链接:http://oj.leetcode.com/problems/interleaving-string/这是一道关于字符串操作的题目,要求是判断一个字符串能不能由两个字符串按照他们自己的顺序,每次挑取两个串中的一个字符来构造出来。像这种判断能否按照某种规则来完成求是否或者某个量的题目,很...

2014-04-29 04:28:00 53 0

Timus 1644. A Whole Lot of Walnuts 算法

Ten big walnuts is a whole lot of walnuts, that's for sure! Two walnuts is too little for anybody. How about six walnuts? Is it a small numb...

2014-04-28 19:26:00 42 0

Timus 1510. Order 找到出现次数过半的数

A New Russian Kolyan likes two things: money and order. Kolyan has lots of money, but there is no order in it. One beautiful morning Kolyan under...

2014-04-28 18:19:00 74 0

Timus 1161. Stripies

Our chemical biologists have invented a new very useful form of life calledstripies(in fact, they were first called in Russian -polosatiki, but the...

2014-04-28 16:08:00 62 0

Timus 1642. 1D Maze迷宫

1D people lived in a 1D country. Everything in the country was one-dimensional, and everything was simple and clear: just one axis and two direct...

2014-04-28 15:28:00 55 0

Timus 2002. Test Task 一个登陆系统

It was an ordinary grim October morning. The sky was covered by heavy gray clouds. It was a little rainy. The rain drops fell on the windows with...

2014-04-28 15:04:00 53 0

Timus 1601. AntiCAPS 修正大写句子

The blonde Angela has a new whim: internet chats. Of course, as any blonde, she writes her messages using the upper case. You are the moderator o...

2014-04-28 14:59:00 56 0

Timus 1180. Stone Game 游戏题目

Two Nikifors play a funny game. There is a heap ofNstones in front of them. Both Nikifors in turns take some stones from the heap. One may take a...

2014-04-28 09:02:00 45 0

Timus 1796. Amusement Park 聪明题

On a sunny Sunday, a group of children headed by their teacher came to an amusement park. Aunt Frosya, who was a very kind and quiet person, work...

2014-04-28 07:52:00 53 0

Reverse Linked List II -- LeetCode

原题链接:http://oj.leetcode.com/problems/reverse-linked-list-ii/这道题是比较常见的链表反转操作,不过不是反转整个链表,而是从m到n的一部分。分为两个步骤,第一步是找到m结点所在位置,第二步就是进行反转直到n结点。反转的方法就是每读到一个结点,...

2014-04-28 04:58:00 33 0

Subsets II -- LeetCode

原题链接:http://oj.leetcode.com/problems/subsets-ii/ 这道题跟Subsets一样是经典的NP问题--求子集。比Subsets稍微复杂一些的是这里的集合中可能出现重复元素,因此我们在求子集的时候要避免出现重复的子集。在Subsets中我们每次加进一个元素...

2014-04-28 04:23:00 35 0

Timus 2011. Long Statement 排列组合的运用

Nikita, a schoolboy, is currently taking part in one of programming contests. He is really upset because all the problem statements are so long a...

2014-04-27 20:44:00 21 0

Timus 1404. Easy to Hack! 有一个密码问题

When Vito Maretti writes an important letter he encrypts it. His method is not very reliable but it’s enough to make any detective understand not...

2014-04-27 20:04:00 30 0

Timus 1120. Sum of Sequential Numbers 数学题

There is no involute formulation concerning factitiously activity of SKB Kontur in this problem. Moreover, there is no formulation at all. I...

2014-04-27 19:31:00 29 0

Timus 1139. City Blocks 题解

The blocks in the city of Fishburg are of square form.Navenues running south to north andMstreets running east to west bound them. A helicopter t...

2014-04-27 16:50:00 33 0

Timus 2005. Taxi for Programmers 题解

The clock shows 11:30 PM. The sports programmers of the institute of maths and computer science have just finished their training. The exhausted ...

2014-04-27 10:53:00 33 0

Timus 1712. Cipher Grille 题解

Our program committee uses different tools for problem development: a mailing list, a version control system, an administration system of theTimu...

2014-04-27 09:15:00 36 0

Timus 1935. Tears of Drowned 详解

Old Captain Jack Sparrow’s friend Tia Dalma, the fortuneteller and prophetess, often makes potions. She has an outstanding collection of the rare...

2014-04-27 07:28:00 27 0

Decode Ways -- LeetCode

原题链接:http://oj.leetcode.com/problems/decode-ways/这道题要求解一个数字串按照字符串编码方式可解析方式的数量。看到这种求数量的,我们很容易想到动态规划来存储前面信息,然后迭代得到最后结果。我们维护的量res[i]是表示前i个数字有多少种解析的方式,接下...

2014-04-27 06:18:00 42 0

Recover Binary Search Tree -- LeetCode

原题链接:http://oj.leetcode.com/problems/recover-binary-search-tree/这道题是要求恢复一颗有两个元素调换错了的二叉查找树。一开始拿到可能会觉得比较复杂,其实观察出规律了就比较简单。主要还是利用二叉查找树的主要性质,就是中序遍历是有序的性质。...

2014-04-27 03:09:00 34 0

Timus 1025. Democracy in Danger 题解

Background In one of the countries of Caribbean basin all decisions were accepted by the simple majority of votes at the general meeting of ci...

2014-04-26 19:34:00 75 0

Timus 1654. Cipher Message 破解密码

Müller tried to catch Stierlitz red-handed many times, but always failed because Stierlitz could ever find some excuse. Once Stierlitz was lookin...

2014-04-26 18:44:00 39 0

Timus 1792. Hamming Code 题解

Let us consider four disks intersecting as in the figure. Each of the three shapes formed by the intersection of three disks will be called apeta...

2014-04-26 15:34:00 36 0

Timus 1131. Copying 数学公式的构造

A new educating program was received by the kindergarten. Of course, children have discovered it immediately and want to play with it as soon as ...

2014-04-26 14:25:00 24 0

Timus 1837. Isenbaev's Number 图论 题解

Vladislav Isenbaev is a two-time champion of Ural, vice champion of TopCoder Open 2009, and absolute champion of ACM ICPC 2009. In the time you w...

2014-04-26 13:19:00 29 0

Gray Code -- LeetCode

原题链接:http://oj.leetcode.com/problems/gray-code/这道题要求求出n位的格雷码对应的二进制数,主要在于找到一种格雷码的递增方法(格雷码并不是唯一的,可以有多种)。我们来看看有了n-1位的格雷码如何得到n位的格雷码呢?其实方法比较简单,首先在n-1位的格雷码...

2014-04-26 06:22:00 47 0

Binary Tree Zigzag Level Order Traversal -- LeetCode

原题链接:http://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/这道题其实还是树的层序遍历Binary Tree Level Order Traversal,如果不熟悉的朋友可以先看看哈。不过这里稍微做...

2014-04-26 04:31:00 35 0

Scramble String -- LeetCode

原题链接:http://oj.leetcode.com/problems/scramble-string/这道题看起来是比较复杂的,如果用brute force,每次做切割,然后递归求解,是一个非多项式的复杂度,一般来说这不是面试官想要的答案。这其实是一道三维动态规划的题目,我们提出维护量res[...

2014-04-26 02:50:00 30 0

Timus 1723. Sandro's Book 题解

It's been quite a number of years since Lich Sandro retired. Sometimes in the evenings, when he feels especially lonely, he takes a book tha...

2014-04-25 18:41:00 53 0

提示
确定要删除当前文章?
取消 删除